Improvements from clippy

This commit is contained in:
Barry Pederson
2025-07-01 20:37:00 -07:00
parent 3fac9def78
commit d9da12a6de
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ fn main() -> std::io::Result<()> {
request.write_to_stream(&mut stream)?;
let response = read_string(&mut stream)?;
println!("Response: {}", response);
println!("Response: {response}");
Ok(())
}
+3 -3
View File
@@ -1,4 +1,4 @@
use std::io::{Error, ErrorKind, Read, Write};
use std::io::{Error, Read, Write};
/// The saslauthd protocol transmits strings as
/// 16-bit unsigned network-byte-order lengths followed
@@ -16,7 +16,7 @@ pub fn read_string(stream: &mut impl Read) -> Result<String, Error> {
match String::from_utf8(string_buffer) {
Ok(str) => Ok(str),
Err(_err) => Err(Error::new(ErrorKind::Other, "Invalid UTF-8 sent")),
Err(_err) => Err(Error::other("Invalid UTF-8 sent")),
}
}
@@ -24,7 +24,7 @@ pub fn write_string(stream: &mut impl Write, s: &str) -> Result<(), Error> {
let length = s.len();
if length > 0xffff {
return Err(Error::new(ErrorKind::Other, "String too long to write"));
return Err(Error::other("String too long to write"));
}
let length_buffer = [(length >> 8) as u8, (length & 0xff) as u8];