From 22e8dc79d19d2a753bc55834e902de2ad4635534 Mon Sep 17 00:00:00 2001 From: Ian Hobson Date: Fri, 12 May 2023 16:52:06 +0200 Subject: [PATCH] clippy: Use a slice argument instead of the owned equivalent --- src/chunks.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/chunks.rs b/src/chunks.rs index 6d1f624..d43e286 100644 --- a/src/chunks.rs +++ b/src/chunks.rs @@ -21,11 +21,7 @@ pub trait ReadBWaveChunks: Read { pub trait WriteBWaveChunks: Write { fn write_wave_fmt(&mut self, format: &WaveFmt) -> Result<(), ParserError>; - fn write_bext_string_field( - &mut self, - string: &String, - length: usize, - ) -> Result<(), ParserError>; + fn write_bext_string_field(&mut self, string: &str, length: usize) -> Result<(), ParserError>; fn write_bext(&mut self, bext: &Bext) -> Result<(), ParserError>; } @@ -51,13 +47,9 @@ where Ok(()) } - fn write_bext_string_field( - &mut self, - string: &String, - length: usize, - ) -> Result<(), ParserError> { + fn write_bext_string_field(&mut self, string: &str, length: usize) -> Result<(), ParserError> { let mut buf = ASCII - .encode(&string, EncoderTrap::Ignore) + .encode(string, EncoderTrap::Ignore) .expect("Error encoding text"); buf.truncate(length); let filler_length = length - buf.len();