Update to nightly: explicit Copy trait

This commit is contained in:
Alexis Mousset
2014-12-12 19:25:23 +01:00
parent dd1ba7d8cf
commit 3040e4dc70
3 changed files with 12 additions and 11 deletions

View File

@@ -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);
}
}

View File

@@ -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]

View File

@@ -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,