Fix tui monitor for example fuzzers (#2699)

* Fix tui monitor for example fuzzers

* New clippy lint

* fix
This commit is contained in:
Dominik Maier 2024-11-16 04:28:11 -03:00 committed by GitHub
parent eb2ac10d1e
commit b3d73b2919
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 20 additions and 20 deletions

View File

@ -9,7 +9,7 @@ edition = "2021"
[features]
default = ["std"]
tui = []
tui = ["libafl/tui_monitor"]
std = []
[profile.dev]

View File

@ -10,7 +10,7 @@ edition = "2021"
[features]
default = ["std"]
tui = []
tui = ["libafl/tui_monitor"]
std = []
[profile.dev]

View File

@ -6,7 +6,7 @@ edition = "2021"
default-run = "fuzzer_sd"
[features]
tui = []
tui = ["libafl/tui_monitor"]
multimap = []
[profile.dev]

View File

@ -9,7 +9,7 @@ edition = "2021"
[features]
default = ["std"]
tui = []
tui = ["libafl/tui_monitor"]
std = []
[profile.dev]

View File

@ -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 {

View File

@ -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());
@ -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());

View File

@ -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));
}

View File

@ -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 {

View File

@ -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;
}
@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -135,7 +135,7 @@ fn main() -> Result<(), Box<dyn Error>> {
}
assert!(
command.status().map_or(false, |s| s.success()),
command.status().is_ok_and(|s| s.success()),
"Couldn't build runtime crate! Did you remember to use nightly? (`rustup default nightly` to install)"
);
@ -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_ok_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)"
);
@ -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_ok_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)"
);

View File

@ -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 {

View File

@ -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");