Skip to content

Make Clippy happy #622

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

Merged
merged 1 commit into from
Jun 20, 2025
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
7 changes: 4 additions & 3 deletions cargo-afl/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ pub fn plugins_available() -> Result<bool> {
let afl_llvm_dir = afl_llvm_dir()?;
for result in afl_llvm_dir
.read_dir()
.with_context(|| format!("could not read {afl_llvm_dir:?}"))?
.with_context(|| format!("could not read `{}`", afl_llvm_dir.display()))?
{
let entry =
result.with_context(|| format!("could not read `DirEntry` in {afl_llvm_dir:?}"))?;
let entry = result.with_context(|| {
format!("could not read `DirEntry` in `{}`", afl_llvm_dir.display())
})?;
let file_name = entry.file_name();
if Path::new(&file_name).extension() == Some(OsStr::new("so")) {
return Ok(true);
Expand Down
12 changes: 9 additions & 3 deletions cargo-afl/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,23 @@ fn copy_afl_llvm_plugins(_args: &Args, work_dir: &Path) -> Result<()> {
// Iterate over the files in the directory.
for result in work_dir
.read_dir()
.with_context(|| format!("could not read {work_dir:?}"))?
.with_context(|| format!("could not read `{}`", work_dir.display()))?
{
let entry = result.with_context(|| format!("could not read `DirEntry` in {work_dir:?}"))?;
let entry = result
.with_context(|| format!("could not read `DirEntry` in `{}`", work_dir.display()))?;
let file_name = entry.file_name();

// Get the file extension. Only copy the files that are shared objects.
if Path::new(&file_name).extension() == Some(OsStr::new("so")) {
// Attempt to copy the shared object file.
let afl_llvm_dir = common::afl_llvm_dir()?;
let _: u64 = std::fs::copy(work_dir.join(&file_name), afl_llvm_dir.join(&file_name))
.with_context(|| format!("could not copy shared object file {file_name:?}"))?;
.with_context(|| {
format!(
"could not copy shared object file `{}`",
file_name.display()
)
})?;
}
}

Expand Down
Loading