From d91a3ca9e02f60641c538e3622da553010e6bbc9 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Thu, 20 Jul 2023 16:49:10 +0200 Subject: [PATCH] Fix new clippy warnings (#1708) --- exercises/practice/paasio/tests/paasio.rs | 21 ++++++++++++++------- exercises/practice/proverb/tests/proverb.rs | 8 ++++---- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/exercises/practice/paasio/tests/paasio.rs b/exercises/practice/paasio/tests/paasio.rs index d13c0d2df..59fdb9999 100644 --- a/exercises/practice/paasio/tests/paasio.rs +++ b/exercises/practice/paasio/tests/paasio.rs @@ -11,7 +11,8 @@ macro_rules! test_read { #[test] fn test_read_passthrough() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut reader = ReadStats::new(data); let mut buffer = Vec::with_capacity(size); @@ -31,7 +32,8 @@ macro_rules! test_read { #[test] fn test_read_chunks() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut reader = ReadStats::new(data); let mut buffer = [0_u8; CHUNK_SIZE]; @@ -51,7 +53,8 @@ macro_rules! test_read { #[test] fn test_read_buffered_chunks() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut reader = BufReader::new(ReadStats::new(data)); let mut buffer = [0_u8; CHUNK_SIZE]; @@ -84,7 +87,8 @@ macro_rules! test_write { #[test] fn test_write_passthrough() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut writer = WriteStats::new(Vec::with_capacity(size)); let written = writer.write(data); assert!(written.is_ok()); @@ -98,7 +102,8 @@ macro_rules! test_write { #[test] fn test_sink_oneshot() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut writer = WriteStats::new(io::sink()); let written = writer.write(data); assert!(written.is_ok()); @@ -111,7 +116,8 @@ macro_rules! test_write { #[test] fn test_sink_windowed() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut writer = WriteStats::new(io::sink()); let mut chunk_count = 0; @@ -129,7 +135,8 @@ macro_rules! test_write { #[test] fn test_sink_buffered_windowed() { let data = $input; - let size = $len(&data); + let len = $len; + let size = len(&data); let mut writer = BufWriter::new(WriteStats::new(io::sink())); for chunk in data.chunks(CHUNK_SIZE) { diff --git a/exercises/practice/proverb/tests/proverb.rs b/exercises/practice/proverb/tests/proverb.rs index fbf8e8cea..a19c2cae5 100644 --- a/exercises/practice/proverb/tests/proverb.rs +++ b/exercises/practice/proverb/tests/proverb.rs @@ -3,7 +3,7 @@ use proverb::build_proverb; #[test] fn test_two_pieces() { let input = vec!["nail", "shoe"]; - let expected = vec![ + let expected = [ "For want of a nail the shoe was lost.", "And all for the want of a nail.", ] @@ -16,7 +16,7 @@ fn test_two_pieces() { #[ignore] fn test_three_pieces() { let input = vec!["nail", "shoe", "horse"]; - let expected = vec![ + let expected = [ "For want of a nail the shoe was lost.", "For want of a shoe the horse was lost.", "And all for the want of a nail.", @@ -47,7 +47,7 @@ fn test_full() { let input = vec![ "nail", "shoe", "horse", "rider", "message", "battle", "kingdom", ]; - let expected = vec![ + let expected = [ "For want of a nail the shoe was lost.", "For want of a shoe the horse was lost.", "For want of a horse the rider was lost.", @@ -64,7 +64,7 @@ fn test_full() { #[ignore] fn test_three_pieces_modernized() { let input = vec!["pin", "gun", "soldier", "battle"]; - let expected = vec![ + let expected = [ "For want of a pin the gun was lost.", "For want of a gun the soldier was lost.", "For want of a soldier the battle was lost.",