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, } }