From d9da12a6deee93f30ced3bfe928ec8407cf446d6 Mon Sep 17 00:00:00 2001 From: Barry Pederson Date: Tue, 1 Jul 2025 20:37:00 -0700 Subject: [PATCH] Improvements from clippy --- client/src/main.rs | 2 +- common/src/io.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index a125652..c5dbd51 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -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(()) } diff --git a/common/src/io.rs b/common/src/io.rs index 6018db7..3a12dd6 100644 --- a/common/src/io.rs +++ b/common/src/io.rs @@ -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 { 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];