Skip to content

Commit 4b45624

Browse files
authored
Merge pull request #105 from Neotron-Compute/clippy-fixes
Clippy fixes.
2 parents 71110b2 + 8c33f26 commit 4b45624

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

neotron-os/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ fn main() {
3737

3838
if option_env!("ROMFS_PATH").is_some() {
3939
println!("cargo::rustc-cfg=romfs_enabled=\"yes\"");
40-
println!("cargo::rustc-check-cfg=cfg(romfs_enabled, values(\"yes\"))");
4140
println!("cargo::rerun-if-env-changed=ROMFS_PATH");
4241
}
42+
println!("cargo::rustc-check-cfg=cfg(romfs_enabled, values(\"yes\"))");
4343
}
4444

4545
/// Put the given script in our output directory and ensure it's on the linker

neotron-os/src/commands/fs.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn romfn(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &
190190
osprintln!("No ROM available");
191191
return;
192192
};
193-
if let Some(arg) = args.get(0) {
193+
if let Some(arg) = args.first() {
194194
let Some(entry) = romfs.find(arg) else {
195195
osprintln!("Couldn't find {} in ROM", arg);
196196
return;
@@ -199,14 +199,12 @@ fn romfn(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &
199199
osprintln!("Error: {:?}", e);
200200
}
201201
} else {
202-
for entry in romfs.into_iter() {
203-
if let Ok(entry) = entry {
204-
osprintln!(
205-
"{} ({} bytes)",
206-
entry.metadata.file_name,
207-
entry.metadata.file_size
208-
);
209-
}
202+
for entry in romfs.into_iter().flatten() {
203+
osprintln!(
204+
"{} ({} bytes)",
205+
entry.metadata.file_name,
206+
entry.metadata.file_size
207+
);
210208
}
211209
}
212210
}

neotron-os/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ static STD_INPUT: CsRefCell<StdInput> = CsRefCell::new(StdInput::new());
6262
static FILESYSTEM: fs::Filesystem = fs::Filesystem::new();
6363

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

6767
#[cfg(not(romfs_enabled = "yes"))]
68-
static ROMFS: &'static [u8] = &[];
68+
static ROMFS: &[u8] = &[];
6969

7070
// ===========================================================================
7171
// Macros

neotron-os/src/program.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ impl TransientProgramArea {
310310
// We support a maximum of four arguments.
311311
#[allow(clippy::get_first)]
312312
let ffi_args = [
313+
#[allow(clippy::get_first)]
313314
neotron_api::FfiString::new(args.get(0).unwrap_or(&"")),
314315
neotron_api::FfiString::new(args.get(1).unwrap_or(&"")),
315316
neotron_api::FfiString::new(args.get(2).unwrap_or(&"")),

utilities/flames/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl App {
136136

137137
/// Generates a number in the range [0, limit)
138138
fn random_up_to(&mut self, limit: usize) -> usize {
139-
let buckets = ::core::usize::MAX / limit;
139+
let buckets = usize::MAX / limit;
140140
let upper_edge = buckets * limit;
141141
loop {
142142
let attempt = self.random();

0 commit comments

Comments
 (0)