From 4f995ef1f541c1c64a9f069604a4bbb71614e28c Mon Sep 17 00:00:00 2001 From: David Peter Date: Wed, 27 Oct 2021 09:50:58 +0200 Subject: [PATCH] Fix clippy warnings --- examples/create_test_file.rs | 4 ++-- src/binocle.rs | 8 +++++--- src/buffer.rs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/create_test_file.rs b/examples/create_test_file.rs index 5715069..ac84460 100644 --- a/examples/create_test_file.rs +++ b/examples/create_test_file.rs @@ -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(()) } diff --git a/src/binocle.rs b/src/binocle.rs index 91aaa73..d600acd 100644 --- a/src/binocle.rs +++ b/src/binocle.rs @@ -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 }) } @@ -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, ); diff --git a/src/buffer.rs b/src/buffer.rs index ed78236..d1b62de 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -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, } }