From 7d4b5dfdb175a9ef6ab8c6db8039be9dc5855c7c Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 17 Aug 2021 19:44:10 +0800 Subject: [PATCH] Make library created with `cargo new` clippy happy Signed-off-by: hi-rustin --- src/cargo/ops/cargo_new.rs | 3 ++- tests/testsuite/init.rs | 6 ++++-- tests/testsuite/new.rs | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index b351e5939e7..89b9d448f8b 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -812,7 +812,8 @@ fn main() { mod tests { #[test] fn it_works() { - assert_eq!(2 + 2, 4); + let result = 2 + 2; + assert_eq!(result, 4); } } " diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs index 93e237591ab..42ccb541844 100644 --- a/tests/testsuite/init.rs +++ b/tests/testsuite/init.rs @@ -572,7 +572,8 @@ fn formats_source() { mod tests { #[test] fn it_works() { - assert_eq!(2 + 2, 4); + let result = 2 + 2; + assert_eq!(result, 4); } } "# @@ -592,7 +593,8 @@ fn ignores_failure_to_format_source() { mod tests { #[test] fn it_works() { - assert_eq!(2 + 2, 4); + let result = 2 + 2; + assert_eq!(result, 4); } } "# diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index fd5499eaea9..71fe63be6a2 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -31,7 +31,8 @@ fn simple_lib() { mod tests { #[test] fn it_works() { - assert_eq!(2 + 2, 4); + let result = 2 + 2; + assert_eq!(result, 4); } } "#