From 4d576d9e53d65a4b43ae73da968a8c5d59264065 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 18 Sep 2023 21:19:03 +0700 Subject: [PATCH] clippy: tests: Fix useless conversion warnings. --- tests/derive.rs | 37 ++++++++----------------------------- tests/test_json.rs | 16 ---------------- 2 files changed, 8 insertions(+), 45 deletions(-) diff --git a/tests/derive.rs b/tests/derive.rs index 7faae42..dbaf7cb 100644 --- a/tests/derive.rs +++ b/tests/derive.rs @@ -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] diff --git a/tests/test_json.rs b/tests/test_json.rs index 5bd14cb..ae482b8 100644 --- a/tests/test_json.rs +++ b/tests/test_json.rs @@ -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);