Clippy & test fixes

This commit is contained in:
simon-curtis
2024-11-05 09:11:24 +00:00
committed by Simon Curtis
parent 88a785a504
commit ced3866916

View File

@ -223,7 +223,7 @@ impl ByteStream {
pub fn skip(self, span: Span, n: u64) -> Result<Self, ShellError> { pub fn skip(self, span: Span, n: u64) -> Result<Self, ShellError> {
if let Some(mut reader) = self.reader() { if let Some(mut reader) = self.reader() {
// Copy the number of skipped bytes into the sink before proceeding // Copy the number of skipped bytes into the sink before proceeding
io::copy(&mut (&mut reader).take(n as u64), &mut io::sink()).err_span(span)?; io::copy(&mut (&mut reader).take(n), &mut io::sink()).err_span(span)?;
Ok(ByteStream::read( Ok(ByteStream::read(
reader, reader,
span, span,
@ -231,10 +231,10 @@ impl ByteStream {
ByteStreamType::Binary, ByteStreamType::Binary,
)) ))
} else { } else {
return Err(ShellError::TypeMismatch { Err(ShellError::TypeMismatch {
err_message: "expected readable stream".into(), err_message: "expected readable stream".into(),
span, span,
}); })
} }
} }
@ -247,10 +247,10 @@ impl ByteStream {
ByteStreamType::Binary, ByteStreamType::Binary,
)) ))
} else { } else {
return Err(ShellError::TypeMismatch { Err(ShellError::TypeMismatch {
err_message: "expected readable stream".into(), err_message: "expected readable stream".into(),
span, span,
}); })
} }
} }
@ -284,7 +284,7 @@ impl ByteStream {
} }
None if start < 0 || end < 0 => Err(ShellError::IncorrectValue { None if start < 0 || end < 0 => Err(ShellError::IncorrectValue {
msg: msg:
"Negative range values cannot be used with streams that don't specify a length" "Relative range values cannot be used with streams that don't specify a length"
.into(), .into(),
val_span, val_span,
call_span, call_span,