clippy: fix warnings in tests

Makes running 'cargo clippy --all-features --tests' work
This commit is contained in:
Paolo Barbolini
2020-09-09 11:53:15 +02:00
committed by Alexis Mousset
parent ec7d63c8de
commit e156520feb
4 changed files with 12 additions and 15 deletions

View File

@@ -143,7 +143,7 @@ mod test {
let mut c = SevenBitCodec::new();
assert_eq!(
&String::from_utf8(c.encode("Hello, world!".as_bytes())).unwrap(),
&String::from_utf8(c.encode(b"Hello, world!")).unwrap(),
"Hello, world!"
);
}
@@ -212,10 +212,7 @@ mod test {
fn base64_encodeed() {
let mut c = Base64Codec::new();
assert_eq!(
&String::from_utf8(c.encode("Chunk.".as_bytes())).unwrap(),
"Q2h1bmsu"
);
assert_eq!(&String::from_utf8(c.encode(b"Chunk.")).unwrap(), "Q2h1bmsu");
}
#[test]
@@ -223,7 +220,7 @@ mod test {
let mut c = EightBitCodec::new();
assert_eq!(
&String::from_utf8(c.encode("Hello, world!".as_bytes())).unwrap(),
&String::from_utf8(c.encode(b"Hello, world!")).unwrap(),
"Hello, world!"
);
@@ -238,7 +235,7 @@ mod test {
let mut c = BinaryCodec::new();
assert_eq!(
&String::from_utf8(c.encode("Hello, world!".as_bytes())).unwrap(),
&String::from_utf8(c.encode(b"Hello, world!")).unwrap(),
"Hello, world!"
);

View File

@@ -535,7 +535,7 @@ mod test {
parameters: vec![header::DispositionParam::Filename(
header::Charset::Ext("utf-8".into()),
None,
"example.c".as_bytes().into(),
"example.c".into(),
)],
})
.header(header::ContentTransferEncoding::Binary)
@@ -582,7 +582,7 @@ mod test {
parameters: vec![header::DispositionParam::Filename(
header::Charset::Ext("utf-8".into()),
None,
"encrypted.asc".as_bytes().into(),
"encrypted.asc".into(),
)],
})
.body(String::from(concat!(
@@ -637,7 +637,7 @@ mod test {
parameters: vec![header::DispositionParam::Filename(
header::Charset::Ext("utf-8".into()),
None,
"signature.asc".as_bytes().into(),
"signature.asc".into(),
)],
})
.body(String::from(concat!(
@@ -725,7 +725,7 @@ mod test {
.header(header::ContentType("text/plain; charset=utf8".parse().unwrap()))
.header(header::ContentDisposition {
disposition: header::DispositionType::Attachment,
parameters: vec![header::DispositionParam::Filename(header::Charset::Ext("utf-8".into()), None, "example.c".as_bytes().into())]
parameters: vec![header::DispositionParam::Filename(header::Charset::Ext("utf-8".into()), None, "example.c".into())]
})
.header(header::ContentTransferEncoding::Binary)
.body(String::from("int main() { return 0; }")));

View File

@@ -335,7 +335,7 @@ mod test {
"RCPT TO:<test@example.com>\r\n"
);
assert_eq!(
format!("{}", Rcpt::new(email.clone(), vec![rcpt_parameter])),
format!("{}", Rcpt::new(email, vec![rcpt_parameter])),
"RCPT TO:<test@example.com> TEST=value\r\n"
);
assert_eq!(format!("{}", Quit), "QUIT\r\n");
@@ -366,7 +366,7 @@ mod test {
assert_eq!(
format!(
"{}",
Auth::new(Mechanism::Login, credentials.clone(), None).unwrap()
Auth::new(Mechanism::Login, credentials, None).unwrap()
),
"AUTH LOGIN\r\n"
);

View File

@@ -320,7 +320,7 @@ mod test {
"{}",
ServerInfo {
name: "name".to_string(),
features: eightbitmime.clone(),
features: eightbitmime,
}
),
"name with {EightBitMime}".to_string()
@@ -347,7 +347,7 @@ mod test {
"{}",
ServerInfo {
name: "name".to_string(),
features: plain.clone(),
features: plain,
}
),
"name with {Authentication(Plain)}".to_string()