Skip to content

Commit

Permalink
style: fix some clippy warnings
Browse files Browse the repository at this point in the history
In this commit I replaced `self.path.join("/")` with
`self.path.join("")` because I think the expected result should be
the original path with trailing "/".

see: https://rust-lang.github.io/rust-clippy/master/index.html#join_absolute_paths
  • Loading branch information
Bogay committed Jan 24, 2025
1 parent 4dd996d commit df9deaf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fuzz_write/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ pub struct FileOperation<'k> {
// 'abort' flag is separate, to prevent trying to copy an aborted file
}

impl<'k> FileOperation<'k> {
impl FileOperation<'_> {
fn get_path(&self) -> Option<PathBuf> {
match &self.basic {
BasicFileOperation::SetArchiveComment(_) => None,
BasicFileOperation::WriteDirectory(_) => Some(self.path.join("/")),
BasicFileOperation::WriteDirectory(_) => Some(self.path.join("")),
BasicFileOperation::MergeWithOtherFile { operations, .. } => operations
.iter()
.flat_map(|(op, abort)| if !abort { op.get_path() } else { None })
Expand Down Expand Up @@ -84,9 +84,9 @@ fn deduplicate_paths(copy: &mut PathBuf, original: &PathBuf) {
}
}

fn do_operation<'k>(
fn do_operation(
writer: &mut zip::ZipWriter<Cursor<Vec<u8>>>,
operation: FileOperation<'k>,
operation: FileOperation<'_>,
abort: bool,
flush_on_finish_file: bool,
files_added: &mut usize,
Expand Down Expand Up @@ -125,7 +125,7 @@ fn do_operation<'k>(
writer.start_file_from_path(&*path, options)?;
for chunk in contents.iter() {
writeln!(stringifier, "writer.write_all(&{:?})?;", chunk)?;
writer.write_all(&chunk)?;
writer.write_all(chunk)?;
}
*files_added += 1;
}
Expand Down Expand Up @@ -298,7 +298,7 @@ fn do_operation<'k>(
Ok(())
}

impl<'k> FuzzTestCase<'k> {
impl FuzzTestCase<'_> {
fn execute(self, stringifier: &mut impl Write, panic_on_error: bool) -> ZipResult<()> {
let mut initial_junk = Cursor::new(self.initial_junk.into_vec());
initial_junk.seek(SeekFrom::End(0))?;
Expand Down Expand Up @@ -332,7 +332,7 @@ impl<'k> FuzzTestCase<'k> {
}
}

impl<'k> Debug for FuzzTestCase<'k> {
impl Debug for FuzzTestCase<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
if self.initial_junk.is_empty() {
writeln!(
Expand Down

0 comments on commit df9deaf

Please sign in to comment.