clippy: tests: Fix useless conversion warnings.

This commit is contained in:
Bruce Mitchener 2023-09-18 21:19:03 +07:00
parent 379514c77d
commit 4d576d9e53
2 changed files with 8 additions and 45 deletions

View File

@ -189,7 +189,7 @@ fn fmt_help() {
assert_eq!(
"1 x hello x \"2\"".to_string(),
FooStruct("hello".into()).help().unwrap().to_string()
FooStruct("hello").help().unwrap().to_string()
);
#[derive(Debug, Diagnostic, Error)]
@ -201,12 +201,7 @@ fn fmt_help() {
assert_eq!(
"1 x hello x \"2\"".to_string(),
BarStruct {
my_field: "hello".into()
}
.help()
.unwrap()
.to_string()
BarStruct { my_field: "hello" }.help().unwrap().to_string()
);
#[derive(Debug, Diagnostic, Error)]
@ -224,7 +219,7 @@ fn fmt_help() {
assert_eq!(
"1 x bar x \"2\"".to_string(),
FooEnum::X("bar".into()).help().unwrap().to_string()
FooEnum::X("bar").help().unwrap().to_string()
);
assert_eq!(
@ -250,12 +245,7 @@ fn help_field() {
assert_eq!(
"x".to_string(),
Foo {
do_this: Some("x".into())
}
.help()
.unwrap()
.to_string()
Foo { do_this: Some("x") }.help().unwrap().to_string()
);
#[derive(Debug, Diagnostic, Error)]
@ -271,16 +261,11 @@ fn help_field() {
assert_eq!(
"x".to_string(),
Bar::A(Some("x".into())).help().unwrap().to_string()
Bar::A(Some("x")).help().unwrap().to_string()
);
assert_eq!(
"x".to_string(),
Bar::B {
do_this: Some("x".into())
}
.help()
.unwrap()
.to_string()
Bar::B { do_this: Some("x") }.help().unwrap().to_string()
);
#[derive(Debug, Diagnostic, Error)]
@ -288,20 +273,14 @@ fn help_field() {
#[diagnostic()]
struct Baz<'a>(#[help] Option<&'a str>);
assert_eq!(
"x".to_string(),
Baz(Some("x".into())).help().unwrap().to_string()
);
assert_eq!("x".to_string(), Baz(Some("x")).help().unwrap().to_string());
#[derive(Debug, Diagnostic, Error)]
#[error("welp")]
#[diagnostic()]
struct Quux<'a>(#[help] &'a str);
assert_eq!(
"x".to_string(),
Quux("x".into()).help().unwrap().to_string()
);
assert_eq!("x".to_string(), Quux("x").help().unwrap().to_string());
}
#[test]

View File

@ -52,7 +52,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -98,7 +97,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -144,7 +142,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -190,7 +187,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -235,7 +231,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -281,7 +276,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -347,7 +341,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -393,7 +386,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -456,7 +448,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -532,7 +523,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -588,7 +578,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -644,7 +633,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -700,7 +688,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -728,7 +715,6 @@ mod json_report_handler {
"related": []
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -822,7 +808,6 @@ mod json_report_handler {
}]
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);
@ -920,7 +905,6 @@ mod json_report_handler {
}]
}"#
.lines()
.into_iter()
.map(|s| s.trim_matches(|c| c == ' ' || c == '\n'))
.collect();
assert_eq!(expected, out);