clippy: Use a slice argument instead of the owned equivalent

This commit is contained in:
Ian Hobson
2023-05-12 16:52:06 +02:00
parent f6f4869b5b
commit 22e8dc79d1

View File

@@ -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();