diff options
| author | Mroik <mroik@delayed.space> | 2026-04-09 03:35:06 +0200 |
|---|---|---|
| committer | Mroik <mroik@delayed.space> | 2026-04-13 06:56:11 +0200 |
| commit | 3cedb01c7982c5a505a510f7af9a9601c39a5b97 (patch) | |
| tree | 5fd79d3baef039c74562402e10284986d8de39c3 /src | |
| parent | 1254bf15b2dee313a9b1c79be779c6b0f6789f1c (diff) | |
Fix some clippy stuff
Signed-off-by: Mroik <mroik@delayed.space>
Diffstat (limited to 'src')
| -rw-r--r-- | src/smtp.rs | 25 |
1 files changed, 10 insertions, 15 deletions
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 <CRLF>.<CRLF>"), + 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 <CRLF>.<CRLF>"), } } } |
