Skip to content

Commit

Permalink
New clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
domenukk committed Nov 16, 2024
1 parent c02de92 commit 3d11a00
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions fuzzers/binary_only/qemu_launcher/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,19 @@ impl FuzzerOptions {
pub fn is_asan_core(&self, core_id: CoreId) -> bool {
self.asan_cores
.as_ref()
.map_or(false, |c| c.contains(core_id))
.is_some_and(|c| c.contains(core_id))
}

pub fn is_asan_guest_core(&self, core_id: CoreId) -> bool {
self.asan_guest_cores
.as_ref()
.map_or(false, |c| c.contains(core_id))
.is_some_and(|c| c.contains(core_id))
}

pub fn is_cmplog_core(&self, core_id: CoreId) -> bool {
self.cmplog_cores
.as_ref()
.map_or(false, |c| c.contains(core_id))
.is_some_and(|c| c.contains(core_id))
}

pub fn input_dir(&self) -> PathBuf {
Expand Down
4 changes: 2 additions & 2 deletions libafl/src/mutators/grimoire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ where
while bytes
.len()
.checked_sub(token_1.len())
.map_or(false, |len| i < len)
.is_some_and(|len| i < len)
{
if bytes[i..].starts_with(token_1) {
bytes.splice(i..(i + token_1.len()), token_2.iter().copied());
Expand All @@ -314,7 +314,7 @@ where
while bytes
.len()
.checked_sub(token_1.len())
.map_or(false, |len| i < len)
.is_some_and(|len| i < len)
{
if bytes[i..].starts_with(token_1) {
bytes.splice(i..(i + token_1.len()), token_2.iter().copied());
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/mutators/unicode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn choose_start<R: Rand>(
if idx
.checked_sub(*start) // idx adjusted to start
.and_then(|idx| (idx < range.len()).then(|| range[idx])) // idx in range
.map_or(false, |r| r)
.is_some_and(|r| r)
{
options.push((*start, range));
}
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/schedulers/accounting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ where
if state
.metadata_map()
.get::<TopAccountingMetadata>()
.map_or(false, |x| x.changed)
.is_some_and(|x| x.changed)
{
self.accounting_cull(state)?;
} else {
Expand Down
4 changes: 2 additions & 2 deletions libafl/src/schedulers/testcase_score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ where
perf_score = HAVOC_MAX_MULT * 100.0;
}

if entry.objectives_found() > 0 && psmeta.strat().map_or(false, |s| s.avoid_crash()) {
if entry.objectives_found() > 0 && psmeta.strat().is_some_and(|s| s.avoid_crash()) {
perf_score *= 0.00;
}

Expand Down Expand Up @@ -342,7 +342,7 @@ where
weight *= 2.0;
}

if entry.objectives_found() > 0 && psmeta.strat().map_or(false, |s| s.avoid_crash()) {
if entry.objectives_found() > 0 && psmeta.strat().is_some_and(|s| s.avoid_crash()) {
weight *= 0.00;
}

Expand Down
2 changes: 1 addition & 1 deletion libafl/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ where
if filename.starts_with('.')
// || filename
// .rsplit_once('-')
// .map_or(false, |(_, s)| u64::from_str(s).is_ok())
// .is_some_and(|(_, s)| u64::from_str(s).is_ok())
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion libafl_cc/src/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl ToolWrapper for ClangWrapper {

if arg_as_path
.extension()
.map_or(false, |ext| ext.eq_ignore_ascii_case("s"))
.is_some_and(|ext| ext.eq_ignore_ascii_case("s"))
{
self.is_asm = true;
}
Expand Down
6 changes: 3 additions & 3 deletions libafl_libfuzzer/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn main() -> Result<(), Box<dyn Error>> {
}

assert!(
command.status().map_or(false, |s| s.success()),
command.status().is_some_and(|s| s.success()),
"Couldn't build runtime crate! Did you remember to use nightly? (`rustup default nightly` to install)"
);

Expand Down Expand Up @@ -199,7 +199,7 @@ fn main() -> Result<(), Box<dyn Error>> {
drop(redefinitions_file);

assert!(
nm_child.wait().map_or(false, |s| s.success()),
nm_child.wait().is_some_and(|s| s.success()),
"Couldn't link runtime crate! Do you have the llvm-tools component installed? (`rustup component add llvm-tools-preview` to install)"
);

Expand Down Expand Up @@ -242,7 +242,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.args([&archive_path, &redefined_archive_path]);

assert!(
objcopy_command.status().map_or(false, |s| s.success()),
objcopy_command.status().is_some_and(|s| s.success()),
"Couldn't rename allocators in the runtime crate! Do you have the llvm-tools component installed? (`rustup component add llvm-tools-preview` to install)"
);

Expand Down
2 changes: 1 addition & 1 deletion libafl_libfuzzer/runtime/src/corpus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ where
.count
.checked_sub(1)
.map(CorpusId::from)
.map_or(false, |last| last == id)
.is_some_and(|last| last == id)
{
self.last.as_ref()
} else {
Expand Down
2 changes: 1 addition & 1 deletion libafl_qemu/libafl_qemu_build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fn qemu_bindgen_clang_args(
entry["output"] == main_obj
|| entry["file"]
.as_str()
.map_or(false, |file| file.ends_with(main_file))
.is_some_and(|file| file.ends_with(main_file))
})
.expect("Didn't find compile command for qemu-system-arm");

Expand Down

0 comments on commit 3d11a00

Please sign in to comment.