diff --git a/src/client/server_info.rs b/src/client/server_info.rs index 15bb618..5090146 100644 --- a/src/client/server_info.rs +++ b/src/client/server_info.rs @@ -48,7 +48,7 @@ impl ServerInfo { match self.esmtp_features { Some(ref esmtp_features) => { for feature in esmtp_features.iter() { - if keyword.same_extension_as(*feature) { + if keyword.same_extension_as(feature) { return Some(*feature); } } diff --git a/src/extension.rs b/src/extension.rs index 67c4cd8..3fd2a5b 100644 --- a/src/extension.rs +++ b/src/extension.rs @@ -19,7 +19,7 @@ use response::Response; use self::Extension::{EightBitMime, SmtpUtfEight, StartTls, Size}; /// Supported ESMTP keywords -#[deriving(PartialEq,Eq,Clone)] +#[deriving(PartialEq,Eq,Copy,Clone)] pub enum Extension { /// 8BITMIME keyword /// @@ -74,12 +74,12 @@ impl FromStr for Extension { impl Extension { /// Checks if the ESMTP keyword is the same - pub fn same_extension_as(&self, other: Extension) -> bool { - if *self == other { + pub fn same_extension_as(&self, other: &Extension) -> bool { + if self == other { return true; } - match (*self, other) { - (Size(_), Size(_)) => true, + match (self, other) { + (&Size(_), &Size(_)) => true, _ => false, } } @@ -128,10 +128,11 @@ mod test { #[test] fn test_same_extension_as() { - assert_eq!(Extension::EightBitMime.same_extension_as(Extension::EightBitMime), true); - assert_eq!(Extension::Size(42).same_extension_as(Extension::Size(42)), true); - assert_eq!(Extension::Size(42).same_extension_as(Extension::Size(43)), true); - assert_eq!(Extension::Size(42).same_extension_as(Extension::EightBitMime), false); + assert_eq!(Extension::EightBitMime.same_extension_as(&Extension::EightBitMime), true); + assert_eq!(Extension::Size(42).same_extension_as(&Extension::Size(42)), true); + assert_eq!(Extension::Size(42).same_extension_as(&Extension::Size(43)), true); + assert_eq!(Extension::Size(42).same_extension_as(&Extension::EightBitMime), false); + assert_eq!(Extension::EightBitMime.same_extension_as(&Extension::SmtpUtfEight), false); } #[test] diff --git a/src/transaction.rs b/src/transaction.rs index ccfb907..dcd9b04 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -18,7 +18,7 @@ use command::Command; use self::TransactionState::{Unconnected, Connected, HelloSent, MailSent, RecipientSent, DataSent}; /// Contains the state of the current transaction -#[deriving(PartialEq,Eq,Clone)] +#[deriving(PartialEq,Eq,Copy)] pub enum TransactionState { /// No connection was established Unconnected,