Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Oct 27, 2021
1 parent 55be86f commit 4f995ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/create_test_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ impl Writer {
}

fn section(&mut self, title: &str) -> Result<()> {
self.file.write_all(&vec![0x42; 10])?;
self.file.write_all(&[0x42; 10])?;
self.file.write_all(title.as_bytes())?;
self.file.write_all(&vec![0x42; 10])?;
self.file.write_all(&[0x42; 10])?;
Ok(())
}

Expand Down
8 changes: 5 additions & 3 deletions src/binocle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ impl Binocle {
}?;

let buffer_length = buffer.len();
let mut settings = Settings::default();
settings.buffer_length = buffer_length as isize;
let settings = Settings {
buffer_length: buffer_length as isize,
..Default::default()
};

Ok(Self { buffer, settings })
}
Expand Down Expand Up @@ -75,7 +77,7 @@ impl Binocle {
let settings = &self.settings;

let view = View::new(
&self.buffer.data(),
self.buffer.data(),
settings.offset + settings.offset_fine,
settings.stride,
);
Expand Down
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Buffer {

pub fn data(&self) -> &[u8] {
match self {
Buffer::VecBuffer(data) => &data,
Buffer::VecBuffer(data) => data,
Buffer::MmapBuffer(mmap) => &mmap.mmap,
}
}
Expand Down

0 comments on commit 4f995ef

Please sign in to comment.