From 3cedb01c7982c5a505a510f7af9a9601c39a5b97 Mon Sep 17 00:00:00 2001 From: Mroik Date: Thu, 9 Apr 2026 03:35:06 +0200 Subject: Fix some clippy stuff Signed-off-by: Mroik --- src/smtp.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/smtp.rs b/src/smtp.rs index 30cf490..2795ecf 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -173,20 +173,15 @@ impl SessionHandler { } } -#[derive(PartialEq)] +#[derive(PartialEq, Default)] enum SessionState { + #[default] WaitingHelo, MailTransaction, AwaitingMailInput, Normal, } -impl Default for SessionState { - fn default() -> Self { - Self::WaitingHelo - } -} - enum Reply { Ready(String), Completed(String), @@ -196,15 +191,15 @@ enum Reply { BadSequence, } -impl ToString for Reply { - fn to_string(&self) -> String { +impl std::fmt::Display for Reply { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Reply::Ready(hostname) => format!("220 {}", hostname), - Reply::Completed(hostname) => format!("250 {}", hostname), - Reply::InvalidCommand => format!("500 Invalid command"), - Reply::InvalidParameter => format!("501 Parameter error"), - Reply::BadSequence => format!("503 Bad sequence of commands"), - Reply::StartMailInput => format!("354 ."), + Reply::Ready(hostname) => write!(f, "220 {}", hostname), + Reply::Completed(hostname) => write!(f, "250 {}", hostname), + Reply::InvalidCommand => write!(f, "500 Invalid command"), + Reply::InvalidParameter => write!(f, "501 Parameter error"), + Reply::BadSequence => write!(f, "503 Bad sequence of commands"), + Reply::StartMailInput => write!(f, "354 ."), } } } -- cgit v1.3