Improvements from clippy
This commit is contained in:
+3
-3
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user