diff --git a/cargo-afl/src/common.rs b/cargo-afl/src/common.rs index f3a893e5c..fa65749d5 100644 --- a/cargo-afl/src/common.rs +++ b/cargo-afl/src/common.rs @@ -75,10 +75,11 @@ pub fn plugins_available() -> Result { 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); diff --git a/cargo-afl/src/config.rs b/cargo-afl/src/config.rs index db602daa5..03e2f4dc0 100644 --- a/cargo-afl/src/config.rs +++ b/cargo-afl/src/config.rs @@ -152,9 +152,10 @@ 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. @@ -162,7 +163,12 @@ fn copy_afl_llvm_plugins(_args: &Args, work_dir: &Path) -> Result<()> { // 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() + ) + })?; } }