Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fixes. #105

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neotron-os/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ fn main() {

if option_env!("ROMFS_PATH").is_some() {
println!("cargo::rustc-cfg=romfs_enabled=\"yes\"");
println!("cargo::rustc-check-cfg=cfg(romfs_enabled, values(\"yes\"))");
println!("cargo::rerun-if-env-changed=ROMFS_PATH");
}
println!("cargo::rustc-check-cfg=cfg(romfs_enabled, values(\"yes\"))");
}

/// Put the given script in our output directory and ensure it's on the linker
Expand Down
16 changes: 7 additions & 9 deletions neotron-os/src/commands/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn romfn(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &
osprintln!("No ROM available");
return;
};
if let Some(arg) = args.get(0) {
if let Some(arg) = args.first() {
let Some(entry) = romfs.find(arg) else {
osprintln!("Couldn't find {} in ROM", arg);
return;
Expand All @@ -199,14 +199,12 @@ fn romfn(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &
osprintln!("Error: {:?}", e);
}
} else {
for entry in romfs.into_iter() {
if let Ok(entry) = entry {
osprintln!(
"{} ({} bytes)",
entry.metadata.file_name,
entry.metadata.file_size
);
}
for entry in romfs.into_iter().flatten() {
osprintln!(
"{} ({} bytes)",
entry.metadata.file_name,
entry.metadata.file_size
);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions neotron-os/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ static STD_INPUT: CsRefCell<StdInput> = CsRefCell::new(StdInput::new());
static FILESYSTEM: fs::Filesystem = fs::Filesystem::new();

#[cfg(romfs_enabled = "yes")]
static ROMFS: &'static [u8] = include_bytes!(env!("ROMFS_PATH"));
static ROMFS: &[u8] = include_bytes!(env!("ROMFS_PATH"));

#[cfg(not(romfs_enabled = "yes"))]
static ROMFS: &'static [u8] = &[];
static ROMFS: &[u8] = &[];

// ===========================================================================
// Macros
Expand Down
1 change: 1 addition & 0 deletions neotron-os/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ impl TransientProgramArea {
// We support a maximum of four arguments.
#[allow(clippy::get_first)]
let ffi_args = [
#[allow(clippy::get_first)]
neotron_api::FfiString::new(args.get(0).unwrap_or(&"")),
neotron_api::FfiString::new(args.get(1).unwrap_or(&"")),
neotron_api::FfiString::new(args.get(2).unwrap_or(&"")),
Expand Down
2 changes: 1 addition & 1 deletion utilities/flames/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl App {

/// Generates a number in the range [0, limit)
fn random_up_to(&mut self, limit: usize) -> usize {
let buckets = ::core::usize::MAX / limit;
let buckets = usize::MAX / limit;
let upper_edge = buckets * limit;
loop {
let attempt = self.random();
Expand Down