Skip to content

Instantly share code, notes, and snippets.

@flip1995
Created August 11, 2021 14:09
Show Gist options
  • Save flip1995/bc4cac6130e651eb2e69f5b6e86ea78b to your computer and use it in GitHub Desktop.
Save flip1995/bc4cac6130e651eb2e69f5b6e86ea78b to your computer and use it in GitHub Desktop.
diff --git a/src/tools/clippy/tests/ui/assign_ops2.stderr b/src/tools/clippy/tests/ui/assign_ops2.stderr
index e40668ed339..04b1dc93d4a 100644
--- a/src/tools/clippy/tests/ui/assign_ops2.stderr
+++ b/src/tools/clippy/tests/ui/assign_ops2.stderr
@@ -8,11 +8,11 @@ LL | a += a + 1;
help: did you mean `a = a + 1` or `a = a + a + 1`? Consider replacing it with
|
LL | a += 1;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a + a + 1;
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:6:5
@@ -23,11 +23,11 @@ LL | a += 1 + a;
help: did you mean `a = a + 1` or `a = a + 1 + a`? Consider replacing it with
|
LL | a += 1;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a + 1 + a;
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:7:5
@@ -38,11 +38,11 @@ LL | a -= a - 1;
help: did you mean `a = a - 1` or `a = a - (a - 1)`? Consider replacing it with
|
LL | a -= 1;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a - (a - 1);
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:8:5
@@ -53,11 +53,11 @@ LL | a *= a * 99;
help: did you mean `a = a * 99` or `a = a * a * 99`? Consider replacing it with
|
LL | a *= 99;
- | ^^^^^^^
+ | ~~~~~~~
help: or
|
LL | a = a * a * 99;
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:9:5
@@ -68,11 +68,11 @@ LL | a *= 42 * a;
help: did you mean `a = a * 42` or `a = a * 42 * a`? Consider replacing it with
|
LL | a *= 42;
- | ^^^^^^^
+ | ~~~~~~~
help: or
|
LL | a = a * 42 * a;
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:10:5
@@ -83,11 +83,11 @@ LL | a /= a / 2;
help: did you mean `a = a / 2` or `a = a / (a / 2)`? Consider replacing it with
|
LL | a /= 2;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a / (a / 2);
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:11:5
@@ -98,11 +98,11 @@ LL | a %= a % 5;
help: did you mean `a = a % 5` or `a = a % (a % 5)`? Consider replacing it with
|
LL | a %= 5;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a % (a % 5);
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:12:5
@@ -113,11 +113,11 @@ LL | a &= a & 1;
help: did you mean `a = a & 1` or `a = a & a & 1`? Consider replacing it with
|
LL | a &= 1;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a & a & 1;
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:13:5
@@ -128,11 +128,11 @@ LL | a *= a * a;
help: did you mean `a = a * a` or `a = a * a * a`? Consider replacing it with
|
LL | a *= a;
- | ^^^^^^
+ | ~~~~~~
help: or
|
LL | a = a * a * a;
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: manual implementation of an assign operation
--> $DIR/assign_ops2.rs:50:5
diff --git a/src/tools/clippy/tests/ui/async_yields_async.stderr b/src/tools/clippy/tests/ui/async_yields_async.stderr
index 17d0c375106..3f2051458f6 100644
--- a/src/tools/clippy/tests/ui/async_yields_async.stderr
+++ b/src/tools/clippy/tests/ui/async_yields_async.stderr
@@ -14,9 +14,9 @@ LL | | };
= note: `-D clippy::async-yields-async` implied by `-D warnings`
help: consider awaiting this value
|
-LL | async {
-LL | 3
-LL | }.await
+LL ~ async {
+LL + 3
+LL + }.await
|
error: an async construct yields a type which is itself awaitable
@@ -47,9 +47,9 @@ LL | | };
|
help: consider awaiting this value
|
-LL | async {
-LL | 3
-LL | }.await
+LL ~ async {
+LL + 3
+LL + }.await
|
error: an async construct yields a type which is itself awaitable
diff --git a/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr b/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
index 50ce2f4051e..e4f605a4de3 100644
--- a/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
+++ b/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
@@ -12,7 +12,7 @@ LL | #![deny(clippy::bind_instead_of_map)]
help: try this
|
LL | let _ = Some("42").map(|s| if s.len() < 42 { 0 } else { s.len() });
- | ^^^ ^ ^^^^^^^
+ | ~~~ ~ ~~~~~~~
error: using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
--> $DIR/bind_instead_of_map_multipart.rs:8:13
@@ -23,7 +23,7 @@ LL | let _ = Ok::<_, ()>("42").and_then(|s| if s.len() < 42 { Ok(0) } else {
help: try this
|
LL | let _ = Ok::<_, ()>("42").map(|s| if s.len() < 42 { 0 } else { s.len() });
- | ^^^ ^ ^^^^^^^
+ | ~~~ ~ ~~~~~~~
error: using `Result.or_else(|x| Err(y))`, which is more succinctly expressed as `map_err(|x| y)`
--> $DIR/bind_instead_of_map_multipart.rs:11:13
@@ -34,7 +34,7 @@ LL | let _ = Err::<(), _>("42").or_else(|s| if s.len() < 42 { Err(s.len() +
help: try this
|
LL | let _ = Err::<(), _>("42").map_err(|s| if s.len() < 42 { s.len() + 20 } else { s.len() });
- | ^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^
+ | ~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> $DIR/bind_instead_of_map_multipart.rs:19:5
@@ -50,10 +50,10 @@ LL | | });
|
help: try this
|
-LL | Some("42").map(|s| {
+LL ~ Some("42").map(|s| {
LL | if {
LL | if s == "43" {
-LL | return 43;
+LL ~ return 43;
LL | }
LL | s == "42"
...
@@ -67,7 +67,7 @@ LL | let _ = Some("").and_then(|s| if s.len() == 20 { Some(m!()) } else { So
help: try this
|
LL | let _ = Some("").map(|s| if s.len() == 20 { m!() } else { Some(20) });
- | ^^^ ^^^^ ^^^^^^^^
+ | ~~~ ~~~~ ~~~~~~~~
error: aborting due to 5 previous errors
diff --git a/src/tools/clippy/tests/ui/blocks_in_if_conditions.stderr b/src/tools/clippy/tests/ui/blocks_in_if_conditions.stderr
index 9328492733f..079f2feb5c4 100644
--- a/src/tools/clippy/tests/ui/blocks_in_if_conditions.stderr
+++ b/src/tools/clippy/tests/ui/blocks_in_if_conditions.stderr
@@ -10,10 +10,10 @@ LL | | } {
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
help: try
|
-LL | let res = {
-LL | let x = 3;
-LL | x == 3
-LL | }; if res {
+LL ~ let res = {
+LL + let x = 3;
+LL + x == 3
+LL ~ }; if res {
|
error: omit braces around single expression condition
diff --git a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr
index 271fcd8b6c1..e3c1bbee994 100644
--- a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr
+++ b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_bottom.stderr
@@ -15,10 +15,10 @@ LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
= note: The end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving the end statements out like this
|
-LL | }
-LL | let result = false;
-LL | println!("Block end!");
-LL | result;
+LL ~ }
+LL + let result = false;
+LL + println!("Block end!");
+LL ~ result;
|
error: all if blocks contain the same code at the end
@@ -30,8 +30,8 @@ LL | | }
|
help: consider moving the end statements out like this
|
-LL | }
-LL | println!("Same end of block");
+LL ~ }
+LL + println!("Same end of block");
|
error: all if blocks contain the same code at the end
@@ -46,11 +46,11 @@ LL | | }
|
help: consider moving the end statements out like this
|
-LL | }
-LL | println!(
-LL | "I'm moveable because I know: `outer_scope_value`: '{}'",
-LL | outer_scope_value
-LL | );
+LL ~ }
+LL + println!(
+LL + "I'm moveable because I know: `outer_scope_value`: '{}'",
+LL + outer_scope_value
+LL + );
|
error: all if blocks contain the same code at the end
@@ -62,8 +62,8 @@ LL | | }
|
help: consider moving the end statements out like this
|
-LL | }
-LL | println!("Hello World");
+LL ~ }
+LL + println!("Hello World");
|
error: all if blocks contain the same code at the end
@@ -78,9 +78,9 @@ LL | | }
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the end statements out like this
|
-LL | }
-LL | let later_used_value = "A string value";
-LL | println!("{}", later_used_value);
+LL ~ }
+LL + let later_used_value = "A string value";
+LL + println!("{}", later_used_value);
|
error: all if blocks contain the same code at the end
@@ -94,9 +94,9 @@ LL | | }
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the end statements out like this
|
-LL | }
-LL | let simple_examples = "I now identify as a &str :)";
-LL | println!("This is the new simple_example: {}", simple_examples);
+LL ~ }
+LL + let simple_examples = "I now identify as a &str :)";
+LL + println!("This is the new simple_example: {}", simple_examples);
|
error: all if blocks contain the same code at the end
@@ -109,8 +109,8 @@ LL | | };
= note: The end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving the end statements out like this
|
-LL | }
-LL | x << 2;
+LL ~ }
+LL ~ x << 2;
|
error: all if blocks contain the same code at the end
@@ -123,8 +123,8 @@ LL | | }
= note: The end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving the end statements out like this
|
-LL | }
-LL | x * 4
+LL ~ }
+LL + x * 4
|
error: all if blocks contain the same code at the end
@@ -135,8 +135,8 @@ LL | if x == 17 { b = 1; a = 0x99; } else { a = 0x99; }
|
help: consider moving the end statements out like this
|
-LL | if x == 17 { b = 1; a = 0x99; } else { }
-LL | a = 0x99;
+LL ~ if x == 17 { b = 1; a = 0x99; } else { }
+LL + a = 0x99;
|
error: aborting due to 9 previous errors
diff --git a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top.stderr b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top.stderr
index 15867e9ea02..8d78fa5de7e 100644
--- a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top.stderr
+++ b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top.stderr
@@ -12,8 +12,8 @@ LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider moving the start statements out like this
|
-LL | println!("Hello World!");
-LL | if true {
+LL ~ println!("Hello World!");
+LL + if true {
|
error: all if blocks contain the same code at the start
@@ -28,10 +28,10 @@ LL | | let _z = y;
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the start statements out like this
|
-LL | let y = 9;
-LL | println!("The value y was set to: `{}`", y);
-LL | let _z = y;
-LL | if x == 0 {
+LL ~ let y = 9;
+LL + println!("The value y was set to: `{}`", y);
+LL + let _z = y;
+LL + if x == 0 {
|
error: all if blocks contain the same code at the start
@@ -43,8 +43,8 @@ LL | | let y = 16;
|
help: consider moving the start statements out like this
|
-LL | let y = 16;
-LL | let _ = if x == 7 {
+LL ~ let y = 16;
+LL + let _ = if x == 7 {
|
error: all if blocks contain the same code at the start
@@ -58,9 +58,9 @@ LL | | println!("Str: {}", used_value_name);
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the start statements out like this
|
-LL | let used_value_name = "Different type";
-LL | println!("Str: {}", used_value_name);
-LL | if x == 10 {
+LL ~ let used_value_name = "Different type";
+LL + println!("Str: {}", used_value_name);
+LL + if x == 10 {
|
error: all if blocks contain the same code at the start
@@ -74,9 +74,9 @@ LL | | println!("I'm also moveable");
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the start statements out like this
|
-LL | let can_be_overridden = "Move me";
-LL | println!("I'm also moveable");
-LL | if x == 11 {
+LL ~ let can_be_overridden = "Move me";
+LL + println!("I'm also moveable");
+LL + if x == 11 {
|
error: all if blocks contain the same code at the start
@@ -89,9 +89,9 @@ LL | | println!("Because `IF_SAME_THEN_ELSE` is allowed here");
|
help: consider moving the start statements out like this
|
-LL | println!("This should trigger the `SHARED_CODE_IN_IF_BLOCKS` lint.");
-LL | println!("Because `IF_SAME_THEN_ELSE` is allowed here");
-LL | if x == 2020 {
+LL ~ println!("This should trigger the `SHARED_CODE_IN_IF_BLOCKS` lint.");
+LL + println!("Because `IF_SAME_THEN_ELSE` is allowed here");
+LL + if x == 2020 {
|
error: this `if` has identical blocks
diff --git a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr
index 212cfb2f1d1..1db2343d3fe 100644
--- a/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr
+++ b/src/tools/clippy/tests/ui/branches_sharing_code/shared_at_top_and_bottom.stderr
@@ -20,15 +20,15 @@ LL | | }
| |_____^
help: consider moving the start statements out like this
|
-LL | let t = 7;
-LL | let _overlap_start = t * 2;
-LL | let _overlap_end = 2 * t;
-LL | if x == 7 {
+LL ~ let t = 7;
+LL + let _overlap_start = t * 2;
+LL + let _overlap_end = 2 * t;
+LL + if x == 7 {
|
help: and consider moving the end statements out like this
|
-LL | }
-LL | let _u = 9;
+LL ~ }
+LL + let _u = 9;
|
error: all if blocks contain the same code at the start and the end. Here at the start
@@ -50,16 +50,16 @@ LL | | }
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the start statements out like this
|
-LL | let r = 7;
-LL | let _overlap_start = r;
-LL | let _overlap_middle = r * r;
-LL | if x == 99 {
+LL ~ let r = 7;
+LL + let _overlap_start = r;
+LL + let _overlap_middle = r * r;
+LL + if x == 99 {
|
help: and consider moving the end statements out like this
|
-LL | }
-LL | let _overlap_end = r * r * r;
-LL | let z = "end";
+LL ~ }
+LL + let _overlap_end = r * r * r;
+LL + let z = "end";
|
error: all if blocks contain the same code at the start and the end. Here at the start
@@ -85,19 +85,19 @@ LL | | }
= warning: Some moved values might need to be renamed to avoid wrong references
help: consider moving the start statements out like this
|
-LL | let a = 0xcafe;
-LL | let b = 0xffff00ff;
-LL | let e_id = gen_id(a, b);
-LL | if (x > 7 && y < 13) || (x + y) % 2 == 1 {
+LL ~ let a = 0xcafe;
+LL + let b = 0xffff00ff;
+LL + let e_id = gen_id(a, b);
+LL + if (x > 7 && y < 13) || (x + y) % 2 == 1 {
|
help: and consider moving the end statements out like this
|
-LL | }
-LL | let pack = DataPack {
-LL | id: e_id,
-LL | name: "Player 1".to_string(),
-LL | some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90],
-LL | };
+LL ~ }
+LL + let pack = DataPack {
+LL + id: e_id,
+LL + name: "Player 1".to_string(),
+LL + some_data: vec![0x12, 0x34, 0x56, 0x78, 0x90],
+LL + };
...
error: all if blocks contain the same code at the start and the end. Here at the start
@@ -116,13 +116,13 @@ LL | | };
= note: The end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving the start statements out like this
|
-LL | let _ = 19;
-LL | let _ = if x == 7 {
+LL ~ let _ = 19;
+LL + let _ = if x == 7 {
|
help: and consider moving the end statements out like this
|
-LL | }
-LL | x << 2;
+LL ~ }
+LL ~ x << 2;
|
error: all if blocks contain the same code at the start and the end. Here at the start
@@ -141,13 +141,13 @@ LL | | }
= note: The end suggestion probably needs some adjustments to use the expression result correctly
help: consider moving the start statements out like this
|
-LL | let _ = 17;
-LL | if x == 9 {
+LL ~ let _ = 17;
+LL + if x == 9 {
|
help: and consider moving the end statements out like this
|
-LL | }
-LL | x * 4
+LL ~ }
+LL + x * 4
|
error: aborting due to 5 previous errors
diff --git a/src/tools/clippy/tests/ui/collapsible_else_if.stderr b/src/tools/clippy/tests/ui/collapsible_else_if.stderr
index ee3e11ae565..6970f660979 100644
--- a/src/tools/clippy/tests/ui/collapsible_else_if.stderr
+++ b/src/tools/clippy/tests/ui/collapsible_else_if.stderr
@@ -12,9 +12,9 @@ LL | | }
= note: `-D clippy::collapsible-else-if` implied by `-D warnings`
help: collapse nested if block
|
-LL | } else if y == "world" {
-LL | println!("world!")
-LL | }
+LL ~ } else if y == "world" {
+LL + println!("world!")
+LL + }
|
error: this `else { if .. }` block can be collapsed
@@ -30,9 +30,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | } else if let Some(42) = Some(42) {
-LL | println!("world!")
-LL | }
+LL ~ } else if let Some(42) = Some(42) {
+LL + println!("world!")
+LL + }
|
error: this `else { if .. }` block can be collapsed
@@ -50,12 +50,12 @@ LL | | }
|
help: collapse nested if block
|
-LL | } else if y == "world" {
-LL | println!("world")
-LL | }
-LL | else {
-LL | println!("!")
-LL | }
+LL ~ } else if y == "world" {
+LL + println!("world")
+LL + }
+LL + else {
+LL + println!("!")
+LL + }
|
error: this `else { if .. }` block can be collapsed
@@ -73,12 +73,12 @@ LL | | }
|
help: collapse nested if block
|
-LL | } else if let Some(42) = Some(42) {
-LL | println!("world")
-LL | }
-LL | else {
-LL | println!("!")
-LL | }
+LL ~ } else if let Some(42) = Some(42) {
+LL + println!("world")
+LL + }
+LL + else {
+LL + println!("!")
+LL + }
|
error: this `else { if .. }` block can be collapsed
@@ -96,12 +96,12 @@ LL | | }
|
help: collapse nested if block
|
-LL | } else if let Some(42) = Some(42) {
-LL | println!("world")
-LL | }
-LL | else {
-LL | println!("!")
-LL | }
+LL ~ } else if let Some(42) = Some(42) {
+LL + println!("world")
+LL + }
+LL + else {
+LL + println!("!")
+LL + }
|
error: this `else { if .. }` block can be collapsed
@@ -119,12 +119,12 @@ LL | | }
|
help: collapse nested if block
|
-LL | } else if x == "hello" {
-LL | println!("world")
-LL | }
-LL | else {
-LL | println!("!")
-LL | }
+LL ~ } else if x == "hello" {
+LL + println!("world")
+LL + }
+LL + else {
+LL + println!("!")
+LL + }
|
error: this `else { if .. }` block can be collapsed
@@ -142,12 +142,12 @@ LL | | }
|
help: collapse nested if block
|
-LL | } else if let Some(42) = Some(42) {
-LL | println!("world")
-LL | }
-LL | else {
-LL | println!("!")
-LL | }
+LL ~ } else if let Some(42) = Some(42) {
+LL + println!("world")
+LL + }
+LL + else {
+LL + println!("!")
+LL + }
|
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/collapsible_if.stderr b/src/tools/clippy/tests/ui/collapsible_if.stderr
index acd1ec3f2ca..6749612388f 100644
--- a/src/tools/clippy/tests/ui/collapsible_if.stderr
+++ b/src/tools/clippy/tests/ui/collapsible_if.stderr
@@ -11,9 +11,9 @@ LL | | }
= note: `-D clippy::collapsible-if` implied by `-D warnings`
help: collapse nested if block
|
-LL | if x == "hello" && y == "world" {
-LL | println!("Hello world!");
-LL | }
+LL ~ if x == "hello" && y == "world" {
+LL + println!("Hello world!");
+LL + }
|
error: this `if` statement can be collapsed
@@ -28,9 +28,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
-LL | println!("Hello world!");
-LL | }
+LL ~ if (x == "hello" || x == "world") && (y == "world" || y == "hello") {
+LL + println!("Hello world!");
+LL + }
|
error: this `if` statement can be collapsed
@@ -45,9 +45,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") {
-LL | println!("Hello world!");
-LL | }
+LL ~ if x == "hello" && x == "world" && (y == "world" || y == "hello") {
+LL + println!("Hello world!");
+LL + }
|
error: this `if` statement can be collapsed
@@ -62,9 +62,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" {
-LL | println!("Hello world!");
-LL | }
+LL ~ if (x == "hello" || x == "world") && y == "world" && y == "hello" {
+LL + println!("Hello world!");
+LL + }
|
error: this `if` statement can be collapsed
@@ -79,9 +79,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | if x == "hello" && x == "world" && y == "world" && y == "hello" {
-LL | println!("Hello world!");
-LL | }
+LL ~ if x == "hello" && x == "world" && y == "world" && y == "hello" {
+LL + println!("Hello world!");
+LL + }
|
error: this `if` statement can be collapsed
@@ -96,9 +96,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | if 42 == 1337 && 'a' != 'A' {
-LL | println!("world!")
-LL | }
+LL ~ if 42 == 1337 && 'a' != 'A' {
+LL + println!("world!")
+LL + }
|
error: this `if` statement can be collapsed
@@ -113,9 +113,9 @@ LL | | }
|
help: collapse nested if block
|
-LL | if x == "hello" && y == "world" { // Collapsible
-LL | println!("Hello world!");
-LL | }
+LL ~ if x == "hello" && y == "world" { // Collapsible
+LL + println!("Hello world!");
+LL + }
|
error: this `if` statement can be collapsed
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3717.stderr b/src/tools/clippy/tests/ui/crashes/ice-3717.stderr
index 296c95abb96..4d3d617b693 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3717.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-3717.stderr
@@ -12,11 +12,11 @@ LL | #![deny(clippy::implicit_hasher)]
help: consider adding a type parameter
|
LL | pub fn ice_3717<S: ::std::hash::BuildHasher + Default>(_: &HashSet<usize, S>) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | let _: HashSet<usize> = HashSet::default();
- | ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6250.stderr b/src/tools/clippy/tests/ui/crashes/ice-6250.stderr
index 320b3bb42f8..439884b7d27 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6250.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-6250.stderr
@@ -30,7 +30,7 @@ LL | Some(reference) = cache.data.get(key) {
help: consider dereferencing the borrow
|
LL | Some(*reference) = cache.data.get(key) {
- | ^
+ | +
error[E0308]: mismatched types
--> $DIR/ice-6250.rs:12:9
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6251.stderr b/src/tools/clippy/tests/ui/crashes/ice-6251.stderr
index 8498c040780..14c71e884b6 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6251.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-6251.stderr
@@ -17,7 +17,7 @@ LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: &[u8]| x }]> {
- | ^
+ | +
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/ice-6251.rs:4:54
diff --git a/src/tools/clippy/tests/ui/dbg_macro.stderr b/src/tools/clippy/tests/ui/dbg_macro.stderr
index bdf372af290..0abe953af26 100644
--- a/src/tools/clippy/tests/ui/dbg_macro.stderr
+++ b/src/tools/clippy/tests/ui/dbg_macro.stderr
@@ -8,7 +8,7 @@ LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
help: ensure to avoid having uses of it in version control
|
LL | if let Some(n) = n.checked_sub(4) { n } else { n }
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
error: `dbg!` macro is intended as a debugging tool
--> $DIR/dbg_macro.rs:8:8
@@ -19,7 +19,7 @@ LL | if dbg!(n <= 1) {
help: ensure to avoid having uses of it in version control
|
LL | if n <= 1 {
- | ^^^^^^
+ | ~~~~~~
error: `dbg!` macro is intended as a debugging tool
--> $DIR/dbg_macro.rs:9:9
@@ -52,7 +52,7 @@ LL | dbg!(42);
help: ensure to avoid having uses of it in version control
|
LL | 42;
- | ^^
+ | ~~
error: `dbg!` macro is intended as a debugging tool
--> $DIR/dbg_macro.rs:17:5
@@ -63,7 +63,7 @@ LL | dbg!(dbg!(dbg!(42)));
help: ensure to avoid having uses of it in version control
|
LL | dbg!(dbg!(42));
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: `dbg!` macro is intended as a debugging tool
--> $DIR/dbg_macro.rs:18:14
@@ -74,7 +74,7 @@ LL | foo(3) + dbg!(factorial(4));
help: ensure to avoid having uses of it in version control
|
LL | foo(3) + factorial(4);
- | ^^^^^^^^^^^^
+ | ~~~~~~~~~~~~
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/entry.stderr b/src/tools/clippy/tests/ui/entry.stderr
index 2f075a97010..8f2e383d675 100644
--- a/src/tools/clippy/tests/ui/entry.stderr
+++ b/src/tools/clippy/tests/ui/entry.stderr
@@ -22,12 +22,12 @@ LL | | }
|
help: try this
|
-LL | m.entry(k).or_insert_with(|| {
-LL | if true {
-LL | v
-LL | } else {
-LL | v2
-LL | }
+LL ~ m.entry(k).or_insert_with(|| {
+LL + if true {
+LL + v
+LL + } else {
+LL + v2
+LL + }
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -44,12 +44,12 @@ LL | | }
|
help: try this
|
-LL | m.entry(k).or_insert_with(|| {
-LL | if true {
-LL | v
-LL | } else {
-LL | v2
-LL | }
+LL ~ m.entry(k).or_insert_with(|| {
+LL + if true {
+LL + v
+LL + } else {
+LL + v2
+LL + }
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -66,12 +66,12 @@ LL | | }
|
help: try this
|
-LL | if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) {
-LL | if true {
-LL | e.insert(v);
-LL | } else {
-LL | e.insert(v2);
-LL | return;
+LL ~ if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) {
+LL + if true {
+LL + e.insert(v);
+LL + } else {
+LL + e.insert(v2);
+LL + return;
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -85,10 +85,10 @@ LL | | }
|
help: try this
|
-LL | m.entry(k).or_insert_with(|| {
-LL | foo();
-LL | v
-LL | });
+LL ~ m.entry(k).or_insert_with(|| {
+LL + foo();
+LL + v
+LL + });
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -105,12 +105,12 @@ LL | | }
|
help: try this
|
-LL | m.entry(k).or_insert_with(|| {
-LL | match 0 {
-LL | 1 if true => {
-LL | v
-LL | },
-LL | _ => {
+LL ~ m.entry(k).or_insert_with(|| {
+LL + match 0 {
+LL + 1 if true => {
+LL + v
+LL + },
+LL + _ => {
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -127,12 +127,12 @@ LL | | }
|
help: try this
|
-LL | if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) {
-LL | match 0 {
-LL | 0 => foo(),
-LL | _ => {
-LL | e.insert(v2);
-LL | },
+LL ~ if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) {
+LL + match 0 {
+LL + 0 => foo(),
+LL + _ => {
+LL + e.insert(v2);
+LL + },
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -149,12 +149,12 @@ LL | | }
|
help: try this
|
-LL | m.entry(k).or_insert_with(|| {
-LL | foo();
-LL | match 0 {
-LL | 0 if false => {
-LL | v
-LL | },
+LL ~ m.entry(k).or_insert_with(|| {
+LL + foo();
+LL + match 0 {
+LL + 0 if false => {
+LL + v
+LL + },
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -176,10 +176,10 @@ LL | | }
|
help: try this
|
-LL | if let std::collections::btree_map::Entry::Vacant(e) = m.entry(k) {
-LL | e.insert(v);
-LL | foo();
-LL | }
+LL ~ if let std::collections::btree_map::Entry::Vacant(e) = m.entry(k) {
+LL + e.insert(v);
+LL + foo();
+LL + }
|
error: aborting due to 10 previous errors
diff --git a/src/tools/clippy/tests/ui/entry_with_else.stderr b/src/tools/clippy/tests/ui/entry_with_else.stderr
index 6f62ff8d374..7279efc5959 100644
--- a/src/tools/clippy/tests/ui/entry_with_else.stderr
+++ b/src/tools/clippy/tests/ui/entry_with_else.stderr
@@ -11,12 +11,12 @@ LL | | }
= note: `-D clippy::map-entry` implied by `-D warnings`
help: try this
|
-LL | match m.entry(k) {
-LL | std::collections::hash_map::Entry::Vacant(e) => {
-LL | e.insert(v);
-LL | }
-LL | std::collections::hash_map::Entry::Occupied(mut e) => {
-LL | e.insert(v2);
+LL ~ match m.entry(k) {
+LL + std::collections::hash_map::Entry::Vacant(e) => {
+LL + e.insert(v);
+LL + }
+LL + std::collections::hash_map::Entry::Occupied(mut e) => {
+LL + e.insert(v2);
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -31,12 +31,12 @@ LL | | }
|
help: try this
|
-LL | match m.entry(k) {
-LL | std::collections::hash_map::Entry::Occupied(mut e) => {
-LL | e.insert(v);
-LL | }
-LL | std::collections::hash_map::Entry::Vacant(e) => {
-LL | e.insert(v2);
+LL ~ match m.entry(k) {
+LL + std::collections::hash_map::Entry::Occupied(mut e) => {
+LL + e.insert(v);
+LL + }
+LL + std::collections::hash_map::Entry::Vacant(e) => {
+LL + e.insert(v2);
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -51,11 +51,11 @@ LL | | }
|
help: try this
|
-LL | if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) {
-LL | e.insert(v);
-LL | } else {
-LL | foo();
-LL | }
+LL ~ if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) {
+LL + e.insert(v);
+LL + } else {
+LL + foo();
+LL + }
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -70,11 +70,11 @@ LL | | }
|
help: try this
|
-LL | if let std::collections::hash_map::Entry::Occupied(mut e) = m.entry(k) {
-LL | e.insert(v);
-LL | } else {
-LL | foo();
-LL | }
+LL ~ if let std::collections::hash_map::Entry::Occupied(mut e) = m.entry(k) {
+LL + e.insert(v);
+LL + } else {
+LL + foo();
+LL + }
|
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -89,12 +89,12 @@ LL | | }
|
help: try this
|
-LL | match m.entry(k) {
-LL | std::collections::hash_map::Entry::Vacant(e) => {
-LL | e.insert(v);
-LL | }
-LL | std::collections::hash_map::Entry::Occupied(mut e) => {
-LL | e.insert(v2);
+LL ~ match m.entry(k) {
+LL + std::collections::hash_map::Entry::Vacant(e) => {
+LL + e.insert(v);
+LL + }
+LL + std::collections::hash_map::Entry::Occupied(mut e) => {
+LL + e.insert(v2);
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -109,12 +109,12 @@ LL | | };
|
help: try this
|
-LL | match m.entry(k) {
-LL | std::collections::hash_map::Entry::Occupied(mut e) => {
-LL | if true { Some(e.insert(v)) } else { Some(e.insert(v2)) }
-LL | }
-LL | std::collections::hash_map::Entry::Vacant(e) => {
-LL | e.insert(v);
+LL ~ match m.entry(k) {
+LL + std::collections::hash_map::Entry::Occupied(mut e) => {
+LL + if true { Some(e.insert(v)) } else { Some(e.insert(v2)) }
+LL + }
+LL + std::collections::hash_map::Entry::Vacant(e) => {
+LL + e.insert(v);
...
error: usage of `contains_key` followed by `insert` on a `HashMap`
@@ -130,12 +130,12 @@ LL | | };
|
help: try this
|
-LL | if let std::collections::hash_map::Entry::Occupied(mut e) = m.entry(k) {
-LL | foo();
-LL | Some(e.insert(v))
-LL | } else {
-LL | None
-LL | };
+LL ~ if let std::collections::hash_map::Entry::Occupied(mut e) = m.entry(k) {
+LL + foo();
+LL + Some(e.insert(v))
+LL + } else {
+LL + None
+LL ~ };
|
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/eprint_with_newline.stderr b/src/tools/clippy/tests/ui/eprint_with_newline.stderr
index 31811d1d92a..090dae3733d 100644
--- a/src/tools/clippy/tests/ui/eprint_with_newline.stderr
+++ b/src/tools/clippy/tests/ui/eprint_with_newline.stderr
@@ -7,8 +7,9 @@ LL | eprint!("Hello/n");
= note: `-D clippy::print-with-newline` implied by `-D warnings`
help: use `eprintln!` instead
|
-LL | eprintln!("Hello");
- | ^^^^^^^^ --
+LL - eprint!("Hello/n");
+LL + eprintln!("Hello");
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:6:5
@@ -18,8 +19,9 @@ LL | eprint!("Hello {}/n", "world");
|
help: use `eprintln!` instead
|
-LL | eprintln!("Hello {}", "world");
- | ^^^^^^^^ --
+LL - eprint!("Hello {}/n", "world");
+LL + eprintln!("Hello {}", "world");
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:7:5
@@ -29,8 +31,9 @@ LL | eprint!("Hello {} {}/n", "world", "#2");
|
help: use `eprintln!` instead
|
-LL | eprintln!("Hello {} {}", "world", "#2");
- | ^^^^^^^^ --
+LL - eprint!("Hello {} {}/n", "world", "#2");
+LL + eprintln!("Hello {} {}", "world", "#2");
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:8:5
@@ -40,8 +43,9 @@ LL | eprint!("{}/n", 1265);
|
help: use `eprintln!` instead
|
-LL | eprintln!("{}", 1265);
- | ^^^^^^^^ --
+LL - eprint!("{}/n", 1265);
+LL + eprintln!("{}", 1265);
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:9:5
@@ -51,8 +55,9 @@ LL | eprint!("/n");
|
help: use `eprintln!` instead
|
-LL | eprintln!();
- | ^^^^^^^^ --
+LL - eprint!("/n");
+LL + eprintln!();
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:28:5
@@ -62,8 +67,9 @@ LL | eprint!("//n"); // should fail
|
help: use `eprintln!` instead
|
-LL | eprintln!("/"); // should fail
- | ^^^^^^^^ --
+LL - eprint!("//n"); // should fail
+LL + eprintln!("/"); // should fail
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:35:5
@@ -76,8 +82,8 @@ LL | | );
|
help: use `eprintln!` instead
|
-LL | eprintln!(
-LL | ""
+LL ~ eprintln!(
+LL ~ ""
|
error: using `eprint!()` with a format string that ends in a single newline
@@ -91,8 +97,8 @@ LL | | );
|
help: use `eprintln!` instead
|
-LL | eprintln!(
-LL | r""
+LL ~ eprintln!(
+LL ~ r""
|
error: using `eprint!()` with a format string that ends in a single newline
@@ -103,8 +109,9 @@ LL | eprint!("/r/n"); //~ ERROR
|
help: use `eprintln!` instead
|
-LL | eprintln!("/r"); //~ ERROR
- | ^^^^^^^^ --
+LL - eprint!("/r/n"); //~ ERROR
+LL + eprintln!("/r"); //~ ERROR
+ |
error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:48:5
@@ -114,8 +121,9 @@ LL | eprint!("foo/rbar/n") // ~ ERROR
|
help: use `eprintln!` instead
|
-LL | eprintln!("foo/rbar") // ~ ERROR
- | ^^^^^^^^ --
+LL - eprint!("foo/rbar/n") // ~ ERROR
+LL + eprintln!("foo/rbar") // ~ ERROR
+ |
error: aborting due to 10 previous errors
diff --git a/src/tools/clippy/tests/ui/exhaustive_items.stderr b/src/tools/clippy/tests/ui/exhaustive_items.stderr
index 8fbab535a9b..f46ebd477b8 100644
--- a/src/tools/clippy/tests/ui/exhaustive_items.stderr
+++ b/src/tools/clippy/tests/ui/exhaustive_items.stderr
@@ -16,8 +16,8 @@ LL | #![deny(clippy::exhaustive_enums, clippy::exhaustive_structs)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: try adding #[non_exhaustive]
|
-LL | #[non_exhaustive]
-LL | pub enum Exhaustive {
+LL ~ #[non_exhaustive]
+LL ~ pub enum Exhaustive {
|
error: exported enums should not be exhaustive
@@ -33,8 +33,8 @@ LL | | }
|
help: try adding #[non_exhaustive]
|
-LL | #[non_exhaustive]
-LL | pub enum ExhaustiveWithAttrs {
+LL ~ #[non_exhaustive]
+LL ~ pub enum ExhaustiveWithAttrs {
|
error: exported structs should not be exhaustive
@@ -53,8 +53,8 @@ LL | #![deny(clippy::exhaustive_enums, clippy::exhaustive_structs)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try adding #[non_exhaustive]
|
-LL | #[non_exhaustive]
-LL | pub struct Exhaustive {
+LL ~ #[non_exhaustive]
+LL ~ pub struct Exhaustive {
|
error: aborting due to 3 previous errors
diff --git a/src/tools/clippy/tests/ui/for_kv_map.stderr b/src/tools/clippy/tests/ui/for_kv_map.stderr
index 241758c542c..e5cc7c1466a 100644
--- a/src/tools/clippy/tests/ui/for_kv_map.stderr
+++ b/src/tools/clippy/tests/ui/for_kv_map.stderr
@@ -8,7 +8,7 @@ LL | for (_, v) in &m {
help: use the corresponding method
|
LL | for v in m.values() {
- | ^ ^^^^^^^^^^
+ | ~ ~~~~~~~~~~
error: you seem to want to iterate on a map's values
--> $DIR/for_kv_map.rs:14:19
@@ -19,7 +19,7 @@ LL | for (_, v) in &*m {
help: use the corresponding method
|
LL | for v in (*m).values() {
- | ^ ^^^^^^^^^^^^^
+ | ~ ~~~~~~~~~~~~~
error: you seem to want to iterate on a map's values
--> $DIR/for_kv_map.rs:22:19
@@ -30,7 +30,7 @@ LL | for (_, v) in &mut m {
help: use the corresponding method
|
LL | for v in m.values_mut() {
- | ^ ^^^^^^^^^^^^^^
+ | ~ ~~~~~~~~~~~~~~
error: you seem to want to iterate on a map's values
--> $DIR/for_kv_map.rs:27:19
@@ -41,7 +41,7 @@ LL | for (_, v) in &mut *m {
help: use the corresponding method
|
LL | for v in (*m).values_mut() {
- | ^ ^^^^^^^^^^^^^^^^^
+ | ~ ~~~~~~~~~~~~~~~~~
error: you seem to want to iterate on a map's keys
--> $DIR/for_kv_map.rs:33:24
@@ -52,7 +52,7 @@ LL | for (k, _value) in rm {
help: use the corresponding method
|
LL | for k in rm.keys() {
- | ^ ^^^^^^^^^
+ | ~ ~~~~~~~~~
error: aborting due to 5 previous errors
diff --git a/src/tools/clippy/tests/ui/format.stderr b/src/tools/clippy/tests/ui/format.stderr
index 2017eb2b383..496a083497d 100644
--- a/src/tools/clippy/tests/ui/format.stderr
+++ b/src/tools/clippy/tests/ui/format.stderr
@@ -29,8 +29,8 @@ LL | | );
|
help: consider using `.to_string()`
|
-LL | r##"foo {}
-LL | " bar"##.to_string();
+LL ~ r##"foo {}
+LL + " bar"##.to_string();
|
error: useless use of `format!`
diff --git a/src/tools/clippy/tests/ui/if_let_some_result.stderr b/src/tools/clippy/tests/ui/if_let_some_result.stderr
index 0646dd27f35..134ce9d2411 100644
--- a/src/tools/clippy/tests/ui/if_let_some_result.stderr
+++ b/src/tools/clippy/tests/ui/if_let_some_result.stderr
@@ -8,7 +8,7 @@ LL | if let Some(y) = x.parse().ok() { y } else { 0 }
help: consider matching on `Ok(y)` and removing the call to `ok` instead
|
LL | if let Ok(y) = x.parse() { y } else { 0 }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~
error: matching on `Some` with `ok()` is redundant
--> $DIR/if_let_some_result.rs:16:9
@@ -19,7 +19,7 @@ LL | if let Some(y) = x . parse() . ok () {
help: consider matching on `Ok(y)` and removing the call to `ok` instead
|
LL | if let Ok(y) = x . parse() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/implicit_hasher.stderr b/src/tools/clippy/tests/ui/implicit_hasher.stderr
index 41ca6485c4c..2e62dd30f9f 100644
--- a/src/tools/clippy/tests/ui/implicit_hasher.stderr
+++ b/src/tools/clippy/tests/ui/implicit_hasher.stderr
@@ -12,11 +12,11 @@ LL | #![deny(clippy::implicit_hasher)]
help: consider adding a type parameter
|
LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashMap<K, V, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:25:36
@@ -27,11 +27,11 @@ LL | impl<K: Hash + Eq, V> Foo<i8> for (HashMap<K, V>,) {
help: consider adding a type parameter
|
LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<i8> for (HashMap<K, V, S>,) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | ((HashMap::default(),), (HashMap::with_capacity_and_hasher(10, Default::default()),))
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:30:19
@@ -42,11 +42,11 @@ LL | impl Foo<i16> for HashMap<String, String> {
help: consider adding a type parameter
|
LL | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashMap<String, String, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:47:32
@@ -57,11 +57,11 @@ LL | impl<T: Hash + Eq> Foo<i8> for HashSet<T> {
help: consider adding a type parameter
|
LL | impl<T: Hash + Eq, S: ::std::hash::BuildHasher + Default> Foo<i8> for HashSet<T, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: impl for `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:52:19
@@ -72,11 +72,11 @@ LL | impl Foo<i16> for HashSet<String> {
help: consider adding a type parameter
|
LL | impl<S: ::std::hash::BuildHasher + Default> Foo<i16> for HashSet<String, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | (HashSet::default(), HashSet::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:69:23
@@ -87,7 +87,7 @@ LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
help: consider adding a type parameter
|
LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:69:53
@@ -98,7 +98,7 @@ LL | pub fn foo(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>) {}
help: consider adding a type parameter
|
LL | pub fn foo<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~
error: impl for `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:73:43
@@ -113,11 +113,11 @@ LL | gen!(impl);
help: consider adding a type parameter
|
LL | impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
help: ...and use generic constructor
|
LL | (HashMap::default(), HashMap::with_capacity_and_hasher(10, Default::default()))
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashMap` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:81:33
@@ -132,7 +132,7 @@ LL | gen!(fn bar);
help: consider adding a type parameter
|
LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32, S>, _set: &mut HashSet<i32>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~~~~~
error: parameter of type `HashSet` should be generalized over different hashers
--> $DIR/implicit_hasher.rs:81:63
@@ -147,7 +147,7 @@ LL | gen!(fn bar);
help: consider adding a type parameter
|
LL | pub fn $name<S: ::std::hash::BuildHasher>(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32, S>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
+ | +++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~
error: aborting due to 10 previous errors
diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr
index 16fe9ed444f..5e078b15ce3 100644
--- a/src/tools/clippy/tests/ui/implicit_return.stderr
+++ b/src/tools/clippy/tests/ui/implicit_return.stderr
@@ -94,9 +94,9 @@ LL | | }
|
help: add `return` as shown
|
-LL | return loop {
-LL | m!(true);
-LL | }
+LL ~ return loop {
+LL + m!(true);
+LL + }
|
error: missing `return` statement
diff --git a/src/tools/clippy/tests/ui/large_enum_variant.stderr b/src/tools/clippy/tests/ui/large_enum_variant.stderr
index d39a4d462aa..0eac28fbd35 100644
--- a/src/tools/clippy/tests/ui/large_enum_variant.stderr
+++ b/src/tools/clippy/tests/ui/large_enum_variant.stderr
@@ -13,7 +13,7 @@ LL | A(i32),
help: consider boxing the large fields to reduce the total size of the enum
|
LL | B(Box<[i32; 8000]>),
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
error: large size difference between variants
--> $DIR/large_enum_variant.rs:36:5
@@ -29,7 +29,7 @@ LL | VariantOk(i32, u32),
help: consider boxing the large fields to reduce the total size of the enum
|
LL | ContainingLargeEnum(Box<LargeEnum>),
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: large size difference between variants
--> $DIR/large_enum_variant.rs:46:5
@@ -62,7 +62,7 @@ LL | VariantOk(i32, u32),
help: consider boxing the large fields to reduce the total size of the enum
|
LL | StructLikeLarge2 { x: Box<[i32; 8000]> },
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors
diff --git a/src/tools/clippy/tests/ui/let_and_return.stderr b/src/tools/clippy/tests/ui/let_and_return.stderr
index a6941dabeb8..17fd694bf7a 100644
--- a/src/tools/clippy/tests/ui/let_and_return.stderr
+++ b/src/tools/clippy/tests/ui/let_and_return.stderr
@@ -9,8 +9,8 @@ LL | x
= note: `-D clippy::let-and-return` implied by `-D warnings`
help: return the expression directly
|
-LL |
-LL | 5
+LL ~
+LL ~ 5
|
error: returning the result of a `let` binding from a block
@@ -23,8 +23,8 @@ LL | x
|
help: return the expression directly
|
-LL |
-LL | 5
+LL ~
+LL ~ 5
|
error: returning the result of a `let` binding from a block
@@ -37,8 +37,8 @@ LL | clone
|
help: return the expression directly
|
-LL |
-LL | Arc::clone(&self.foo) as _
+LL ~
+LL ~ Arc::clone(&self.foo) as _
|
error: aborting due to 3 previous errors
diff --git a/src/tools/clippy/tests/ui/let_unit.stderr b/src/tools/clippy/tests/ui/let_unit.stderr
index eb8482087bc..f2600c6c228 100644
--- a/src/tools/clippy/tests/ui/let_unit.stderr
+++ b/src/tools/clippy/tests/ui/let_unit.stderr
@@ -26,12 +26,12 @@ LL | | .unwrap();
|
help: omit the `let` binding
|
-LL | v
-LL | .into_iter()
-LL | .map(|i| i * 2)
-LL | .filter(|i| i % 2 == 0)
-LL | .map(|_| ())
-LL | .next()
+LL ~ v
+LL + .into_iter()
+LL + .map(|i| i * 2)
+LL + .filter(|i| i % 2 == 0)
+LL + .map(|_| ())
+LL + .next()
...
error: aborting due to 3 previous errors
diff --git a/src/tools/clippy/tests/ui/literals.stderr b/src/tools/clippy/tests/ui/literals.stderr
index 64ceeb316d8..99542e20f78 100644
--- a/src/tools/clippy/tests/ui/literals.stderr
+++ b/src/tools/clippy/tests/ui/literals.stderr
@@ -28,11 +28,11 @@ LL | let fail_multi_zero = 000_123usize;
help: if you mean to use a decimal constant, remove the `0` to avoid confusion
|
LL | let fail_multi_zero = 123usize;
- | ^^^^^^^^
+ | ~~~~~~~~
help: if you mean to use an octal constant, use `0o`
|
LL | let fail_multi_zero = 0o123usize;
- | ^^^^^^^^^^
+ | ~~~~~~~~~~
error: this is a decimal constant
--> $DIR/literals.rs:21:17
@@ -43,11 +43,11 @@ LL | let fail8 = 0123;
help: if you mean to use a decimal constant, remove the `0` to avoid confusion
|
LL | let fail8 = 123;
- | ^^^
+ | ~~~
help: if you mean to use an octal constant, use `0o`
|
LL | let fail8 = 0o123;
- | ^^^^^
+ | ~~~~~
error: digits grouped inconsistently by underscores
--> $DIR/literals.rs:33:18
diff --git a/src/tools/clippy/tests/ui/manual_async_fn.stderr b/src/tools/clippy/tests/ui/manual_async_fn.stderr
index fdd43db3255..51f1a52b6dd 100644
--- a/src/tools/clippy/tests/ui/manual_async_fn.stderr
+++ b/src/tools/clippy/tests/ui/manual_async_fn.stderr
@@ -8,11 +8,11 @@ LL | fn fut() -> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL | async fn fut() -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn fut() -> impl Future<Output = i32> { 42 }
- | ^^^^^^
+ | ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:13:1
@@ -23,11 +23,11 @@ LL | fn fut2() ->impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL | async fn fut2() -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn fut2() ->impl Future<Output = i32> { 42 }
- | ^^^^^^
+ | ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:18:1
@@ -38,11 +38,11 @@ LL | fn fut3()-> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL | async fn fut3() -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn fut3()-> impl Future<Output = i32> { 42 }
- | ^^^^^^
+ | ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:22:1
@@ -53,11 +53,11 @@ LL | fn empty_fut() -> impl Future<Output = ()> {
help: make the function `async` and remove the return type
|
LL | async fn empty_fut() {
- | ^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn empty_fut() -> impl Future<Output = ()> {}
- | ^^
+ | ~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:27:1
@@ -68,11 +68,11 @@ LL | fn empty_fut2() ->impl Future<Output = ()> {
help: make the function `async` and remove the return type
|
LL | async fn empty_fut2() {
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn empty_fut2() ->impl Future<Output = ()> {}
- | ^^
+ | ~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:32:1
@@ -83,11 +83,11 @@ LL | fn empty_fut3()-> impl Future<Output = ()> {
help: make the function `async` and remove the return type
|
LL | async fn empty_fut3() {
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn empty_fut3()-> impl Future<Output = ()> {}
- | ^^
+ | ~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:36:1
@@ -98,11 +98,11 @@ LL | fn core_fut() -> impl core::future::Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL | async fn core_fut() -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn core_fut() -> impl core::future::Future<Output = i32> { 42 }
- | ^^^^^^
+ | ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:58:5
@@ -113,15 +113,15 @@ LL | fn inh_fut() -> impl Future<Output = i32> {
help: make the function `async` and return the output of the future directly
|
LL | async fn inh_fut() -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
-LL | fn inh_fut() -> impl Future<Output = i32> {
-LL | // NOTE: this code is here just to check that the indentation is correct in the suggested fix
-LL | let a = 42;
-LL | let b = 21;
-LL | if a < b {
-LL | let c = 21;
+LL ~ fn inh_fut() -> impl Future<Output = i32> {
+LL + // NOTE: this code is here just to check that the indentation is correct in the suggested fix
+LL + let a = 42;
+LL + let b = 21;
+LL + if a < b {
+LL + let c = 21;
...
error: this function can be simplified using the `async fn` syntax
@@ -133,11 +133,11 @@ LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ {
help: make the function `async` and return the output of the future directly
|
LL | async fn elided(_: &i32) -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ { 42 }
- | ^^^^^^
+ | ~~~~~~
error: this function can be simplified using the `async fn` syntax
--> $DIR/manual_async_fn.rs:102:1
@@ -148,11 +148,11 @@ LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> +
help: make the function `async` and return the output of the future directly
|
LL | async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: move the body of the async block to the enclosing function
|
LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b { 42 }
- | ^^^^^^
+ | ~~~~~~
error: aborting due to 10 previous errors
diff --git a/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr b/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr
index a2f2dfce168..0243158dec5 100644
--- a/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr
+++ b/src/tools/clippy/tests/ui/manual_memcpy/with_loop_counters.stderr
@@ -85,8 +85,8 @@ LL | | }
|
help: try replacing the loop by
|
-LL | dst[3..(src.len() + 3)].clone_from_slice(&src[..]);
-LL | dst2[30..(src.len() + 30)].clone_from_slice(&src[..]);
+LL ~ dst[3..(src.len() + 3)].clone_from_slice(&src[..]);
+LL + dst2[30..(src.len() + 30)].clone_from_slice(&src[..]);
|
error: it looks like you're manually copying between slices
diff --git a/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr b/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr
index 54b966f6e54..8ff0137a812 100644
--- a/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr
+++ b/src/tools/clippy/tests/ui/manual_memcpy/without_loop_counters.stderr
@@ -51,8 +51,8 @@ LL | | }
|
help: try replacing the loop by
|
-LL | dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]);
-LL | dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]);
+LL ~ dst[10..256].clone_from_slice(&src[(10 - 5)..(256 - 5)]);
+LL + dst2[(10 + 500)..(256 + 500)].clone_from_slice(&src[10..256]);
|
error: it looks like you're manually copying between slices
diff --git a/src/tools/clippy/tests/ui/manual_ok_or.stderr b/src/tools/clippy/tests/ui/manual_ok_or.stderr
index 8ea10ac5436..65459a09738 100644
--- a/src/tools/clippy/tests/ui/manual_ok_or.stderr
+++ b/src/tools/clippy/tests/ui/manual_ok_or.stderr
@@ -32,9 +32,9 @@ LL | | );
|
help: replace with
|
-LL | foo.ok_or(&format!(
-LL | "{}{}{}{}{}{}{}",
-LL | "Alice", "Bob", "Sarah", "Marc", "Sandra", "Eric", "Jenifer"));
+LL ~ foo.ok_or(&format!(
+LL + "{}{}{}{}{}{}{}",
+LL ~ "Alice", "Bob", "Sarah", "Marc", "Sandra", "Eric", "Jenifer"));
|
error: aborting due to 4 previous errors
diff --git a/src/tools/clippy/tests/ui/manual_strip.stderr b/src/tools/clippy/tests/ui/manual_strip.stderr
index 1352a8713d4..896edf2ae51 100644
--- a/src/tools/clippy/tests/ui/manual_strip.stderr
+++ b/src/tools/clippy/tests/ui/manual_strip.stderr
@@ -12,12 +12,12 @@ LL | if s.starts_with("ab") {
| ^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s.strip_prefix("ab") {
-LL | str::to_string(<stripped>);
-LL | <stripped>.to_string();
+LL ~ if let Some(<stripped>) = s.strip_prefix("ab") {
+LL ~ str::to_string(<stripped>);
+LL ~ <stripped>.to_string();
LL |
-LL | str::to_string(<stripped>);
-LL | <stripped>.to_string();
+LL ~ str::to_string(<stripped>);
+LL ~ <stripped>.to_string();
|
error: stripping a suffix manually
@@ -33,12 +33,12 @@ LL | if s.ends_with("bc") {
| ^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_suffix` method
|
-LL | if let Some(<stripped>) = s.strip_suffix("bc") {
-LL | str::to_string(<stripped>);
-LL | <stripped>.to_string();
+LL ~ if let Some(<stripped>) = s.strip_suffix("bc") {
+LL ~ str::to_string(<stripped>);
+LL ~ <stripped>.to_string();
LL |
-LL | str::to_string(<stripped>);
-LL | <stripped>.to_string();
+LL ~ str::to_string(<stripped>);
+LL ~ <stripped>.to_string();
|
error: stripping a prefix manually
@@ -54,9 +54,9 @@ LL | if s.starts_with('a') {
| ^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s.strip_prefix('a') {
-LL | str::to_string(<stripped>);
-LL | <stripped>.to_string();
+LL ~ if let Some(<stripped>) = s.strip_prefix('a') {
+LL ~ str::to_string(<stripped>);
+LL ~ <stripped>.to_string();
|
error: stripping a prefix manually
@@ -72,8 +72,8 @@ LL | if s.starts_with(prefix) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s.strip_prefix(prefix) {
-LL | str::to_string(<stripped>);
+LL ~ if let Some(<stripped>) = s.strip_prefix(prefix) {
+LL ~ str::to_string(<stripped>);
|
error: stripping a prefix manually
@@ -89,9 +89,9 @@ LL | if s.starts_with(PREFIX) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s.strip_prefix(PREFIX) {
-LL | str::to_string(<stripped>);
-LL | str::to_string(<stripped>);
+LL ~ if let Some(<stripped>) = s.strip_prefix(PREFIX) {
+LL ~ str::to_string(<stripped>);
+LL ~ str::to_string(<stripped>);
|
error: stripping a prefix manually
@@ -107,8 +107,8 @@ LL | if TARGET.starts_with(prefix) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = TARGET.strip_prefix(prefix) {
-LL | str::to_string(<stripped>);
+LL ~ if let Some(<stripped>) = TARGET.strip_prefix(prefix) {
+LL ~ str::to_string(<stripped>);
|
error: stripping a prefix manually
@@ -124,8 +124,8 @@ LL | if s1.starts_with("ab") {
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s1.strip_prefix("ab") {
-LL | <stripped>.to_uppercase();
+LL ~ if let Some(<stripped>) = s1.strip_prefix("ab") {
+LL ~ <stripped>.to_uppercase();
|
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/manual_unwrap_or.stderr b/src/tools/clippy/tests/ui/manual_unwrap_or.stderr
index 99625b789b6..0e4cb798d45 100644
--- a/src/tools/clippy/tests/ui/manual_unwrap_or.stderr
+++ b/src/tools/clippy/tests/ui/manual_unwrap_or.stderr
@@ -41,11 +41,11 @@ LL | | };
|
help: replace with
|
-LL | Some(1).unwrap_or({
-LL | 42 + 42
-LL | + 42 + 42 + 42
-LL | + 42 + 42 + 42
-LL | });
+LL ~ Some(1).unwrap_or({
+LL + 42 + 42
+LL + + 42 + 42 + 42
+LL + + 42 + 42 + 42
+LL ~ });
|
error: this pattern reimplements `Option::unwrap_or`
@@ -125,11 +125,11 @@ LL | | };
|
help: replace with
|
-LL | Ok::<i32, &str>(1).unwrap_or({
-LL | 42 + 42
-LL | + 42 + 42 + 42
-LL | + 42 + 42 + 42
-LL | });
+LL ~ Ok::<i32, &str>(1).unwrap_or({
+LL + 42 + 42
+LL + + 42 + 42 + 42
+LL + + 42 + 42 + 42
+LL ~ });
|
error: this pattern reimplements `Result::unwrap_or`
diff --git a/src/tools/clippy/tests/ui/map_unwrap_or.stderr b/src/tools/clippy/tests/ui/map_unwrap_or.stderr
index 96b9d6cc3c1..954000b8b76 100644
--- a/src/tools/clippy/tests/ui/map_unwrap_or.stderr
+++ b/src/tools/clippy/tests/ui/map_unwrap_or.stderr
@@ -10,8 +10,9 @@ LL | | .unwrap_or(0);
= note: `-D clippy::map-unwrap-or` implied by `-D warnings`
help: use `map_or(<a>, <f>)` instead
|
-LL | let _ = opt.map_or(0, |x| x + 1);
- | ^^^^^^ ^^ --
+LL - let _ = opt.map(|x| x + 1)
+LL + let _ = opt.map_or(0, |x| x + 1);
+ |
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
--> $DIR/map_unwrap_or.rs:20:13
@@ -25,10 +26,10 @@ LL | | ).unwrap_or(0);
|
help: use `map_or(<a>, <f>)` instead
|
-LL | let _ = opt.map_or(0, |x| {
+LL ~ let _ = opt.map_or(0, |x| {
LL | x + 1
LL | }
-LL | );
+LL ~ );
|
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
@@ -43,9 +44,9 @@ LL | | });
|
help: use `map_or(<a>, <f>)` instead
|
-LL | let _ = opt.map_or({
-LL | 0
-LL | }, |x| x + 1);
+LL ~ let _ = opt.map_or({
+LL + 0
+LL ~ }, |x| x + 1);
|
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
@@ -56,8 +57,9 @@ LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
|
help: use `and_then(<f>)` instead
|
-LL | let _ = opt.and_then(|x| Some(x + 1));
- | ^^^^^^^^ --
+LL - let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
+LL + let _ = opt.and_then(|x| Some(x + 1));
+ |
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
--> $DIR/map_unwrap_or.rs:31:13
@@ -71,10 +73,10 @@ LL | | ).unwrap_or(None);
|
help: use `and_then(<f>)` instead
|
-LL | let _ = opt.and_then(|x| {
+LL ~ let _ = opt.and_then(|x| {
LL | Some(x + 1)
LL | }
-LL | );
+LL ~ );
|
error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
@@ -88,8 +90,9 @@ LL | | .unwrap_or(None);
|
help: use `and_then(<f>)` instead
|
-LL | .and_then(|x| Some(x + 1));
- | ^^^^^^^^ --
+LL - .map(|x| Some(x + 1))
+LL + .and_then(|x| Some(x + 1));
+ |
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
--> $DIR/map_unwrap_or.rs:46:13
@@ -99,8 +102,9 @@ LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
|
help: use `map_or(<a>, <f>)` instead
|
-LL | let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
- | ^^^^^^ ^^^ --
+LL - let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
+LL + let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
+ |
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
--> $DIR/map_unwrap_or.rs:50:13
diff --git a/src/tools/clippy/tests/ui/match_bool.stderr b/src/tools/clippy/tests/ui/match_bool.stderr
index 1ad78c740c6..3fd0468e51d 100644
--- a/src/tools/clippy/tests/ui/match_bool.stderr
+++ b/src/tools/clippy/tests/ui/match_bool.stderr
@@ -43,9 +43,9 @@ LL | | };
|
help: consider using an `if`/`else` expression
|
-LL | if !test {
-LL | println!("Noooo!");
-LL | };
+LL ~ if !test {
+LL + println!("Noooo!");
+LL ~ };
|
error: you seem to be trying to match on a boolean expression
@@ -61,9 +61,9 @@ LL | | };
|
help: consider using an `if`/`else` expression
|
-LL | if !test {
-LL | println!("Noooo!");
-LL | };
+LL ~ if !test {
+LL + println!("Noooo!");
+LL ~ };
|
error: you seem to be trying to match on a boolean expression
@@ -79,9 +79,9 @@ LL | | };
|
help: consider using an `if`/`else` expression
|
-LL | if !(test && test) {
-LL | println!("Noooo!");
-LL | };
+LL ~ if !(test && test) {
+LL + println!("Noooo!");
+LL ~ };
|
error: equal expressions as operands to `&&`
@@ -106,11 +106,11 @@ LL | | };
|
help: consider using an `if`/`else` expression
|
-LL | if test {
-LL | println!("Yes!");
-LL | } else {
-LL | println!("Noooo!");
-LL | };
+LL ~ if test {
+LL + println!("Yes!");
+LL + } else {
+LL + println!("Noooo!");
+LL ~ };
|
error: aborting due to 8 previous errors
diff --git a/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr b/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr
index f27b4e9cb20..366ef36c367 100644
--- a/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr
+++ b/src/tools/clippy/tests/ui/match_expr_like_matches_macro.stderr
@@ -123,8 +123,8 @@ LL | | };
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
help: try
|
-LL | let _res = match val {
-LL | Some(ref _a) => true,
+LL ~ let _res = match val {
+LL ~ Some(ref _a) => true,
|
error: match expression looks like `matches!` macro
@@ -149,8 +149,8 @@ LL | | };
|
help: try
|
-LL | let _res = match val {
-LL | Some(ref _a) => true,
+LL ~ let _res = match val {
+LL ~ Some(ref _a) => true,
|
error: aborting due to 14 previous errors
diff --git a/src/tools/clippy/tests/ui/match_ref_pats.stderr b/src/tools/clippy/tests/ui/match_ref_pats.stderr
index 67474e65cde..a57a338b276 100644
--- a/src/tools/clippy/tests/ui/match_ref_pats.stderr
+++ b/src/tools/clippy/tests/ui/match_ref_pats.stderr
@@ -10,9 +10,9 @@ LL | | }
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
-LL | match *v {
-LL | Some(v) => println!("{:?}", v),
-LL | None => println!("none"),
+LL ~ match *v {
+LL ~ Some(v) => println!("{:?}", v),
+LL ~ None => println!("none"),
|
error: you don't need to add `&` to all patterns
@@ -26,8 +26,8 @@ LL | | }
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
-LL | match *tup {
-LL | (v, 1) => println!("{}", v),
+LL ~ match *tup {
+LL ~ (v, 1) => println!("{}", v),
|
error: you don't need to add `&` to both the expression and the patterns
@@ -41,9 +41,9 @@ LL | | }
|
help: try
|
-LL | match w {
-LL | Some(v) => println!("{:?}", v),
-LL | None => println!("none"),
+LL ~ match w {
+LL ~ Some(v) => println!("{:?}", v),
+LL ~ None => println!("none"),
|
error: redundant pattern matching, consider using `is_none()`
@@ -65,7 +65,7 @@ LL | | }
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
LL | if let None = *a {
- | ^^^^ ^^
+ | ~~~~ ~~
error: redundant pattern matching, consider using `is_none()`
--> $DIR/match_ref_pats.rs:40:12
@@ -84,7 +84,7 @@ LL | | }
help: try
|
LL | if let None = b {
- | ^^^^ ^
+ | ~~~~ ~
error: you don't need to add `&` to all patterns
--> $DIR/match_ref_pats.rs:67:9
@@ -97,8 +97,8 @@ LL | | }
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
-LL | match *foo_variant!(0) {
-LL | Foo::A => println!("A"),
+LL ~ match *foo_variant!(0) {
+LL ~ Foo::A => println!("A"),
|
error: aborting due to 8 previous errors
diff --git a/src/tools/clippy/tests/ui/match_single_binding.stderr b/src/tools/clippy/tests/ui/match_single_binding.stderr
index 795c8c3e24d..291fa77dc2e 100644
--- a/src/tools/clippy/tests/ui/match_single_binding.stderr
+++ b/src/tools/clippy/tests/ui/match_single_binding.stderr
@@ -11,10 +11,10 @@ LL | | }
= note: `-D clippy::match-single-binding` implied by `-D warnings`
help: consider using `let` statement
|
-LL | let (x, y, z) = (a, b, c);
-LL | {
-LL | println!("{} {} {}", x, y, z);
-LL | }
+LL ~ let (x, y, z) = (a, b, c);
+LL + {
+LL + println!("{} {} {}", x, y, z);
+LL + }
|
error: this match could be written as a `let` statement
@@ -27,8 +27,8 @@ LL | | }
|
help: consider using `let` statement
|
-LL | let (x, y, z) = (a, b, c);
-LL | println!("{} {} {}", x, y, z);
+LL ~ let (x, y, z) = (a, b, c);
+LL + println!("{} {} {}", x, y, z);
|
error: this match could be replaced by its body itself
@@ -52,10 +52,10 @@ LL | | }
|
help: consider using the match body instead
|
-LL | {
-LL | let x = 29;
-LL | println!("x has a value of {}", x);
-LL | }
+LL ~ {
+LL + let x = 29;
+LL + println!("x has a value of {}", x);
+LL + }
|
error: this match could be replaced by its body itself
@@ -72,12 +72,12 @@ LL | | }
|
help: consider using the match body instead
|
-LL | {
-LL | let e = 5 * a;
-LL | if e >= 5 {
-LL | println!("e is superior to 5");
-LL | }
-LL | }
+LL ~ {
+LL + let e = 5 * a;
+LL + if e >= 5 {
+LL + println!("e is superior to 5");
+LL + }
+LL + }
|
error: this match could be written as a `let` statement
@@ -90,8 +90,8 @@ LL | | }
|
help: consider using `let` statement
|
-LL | let Point { x, y } = p;
-LL | println!("Coords: ({}, {})", x, y);
+LL ~ let Point { x, y } = p;
+LL + println!("Coords: ({}, {})", x, y);
|
error: this match could be written as a `let` statement
@@ -104,8 +104,8 @@ LL | | }
|
help: consider using `let` statement
|
-LL | let Point { x: x1, y: y1 } = p;
-LL | println!("Coords: ({}, {})", x1, y1);
+LL ~ let Point { x: x1, y: y1 } = p;
+LL + println!("Coords: ({}, {})", x1, y1);
|
error: this match could be written as a `let` statement
@@ -118,8 +118,8 @@ LL | | }
|
help: consider using `let` statement
|
-LL | let ref r = x;
-LL | println!("Got a reference to {}", r);
+LL ~ let ref r = x;
+LL + println!("Got a reference to {}", r);
|
error: this match could be written as a `let` statement
@@ -132,8 +132,8 @@ LL | | }
|
help: consider using `let` statement
|
-LL | let ref mut mr = x;
-LL | println!("Got a mutable reference to {}", mr);
+LL ~ let ref mut mr = x;
+LL + println!("Got a mutable reference to {}", mr);
|
error: this match could be written as a `let` statement
@@ -146,8 +146,8 @@ LL | | };
|
help: consider using `let` statement
|
-LL | let Point { x, y } = coords();
-LL | let product = x * y;
+LL ~ let Point { x, y } = coords();
+LL + let product = x * y;
|
error: this match could be written as a `let` statement
@@ -161,10 +161,10 @@ LL | | })
|
help: consider using `let` statement
|
-LL | .map(|i| {
-LL | let unwrapped = i.unwrap();
-LL | unwrapped
-LL | })
+LL ~ .map(|i| {
+LL + let unwrapped = i.unwrap();
+LL + unwrapped
+LL ~ })
|
error: aborting due to 11 previous errors
diff --git a/src/tools/clippy/tests/ui/match_single_binding2.stderr b/src/tools/clippy/tests/ui/match_single_binding2.stderr
index 4372f55af87..d3493319466 100644
--- a/src/tools/clippy/tests/ui/match_single_binding2.stderr
+++ b/src/tools/clippy/tests/ui/match_single_binding2.stderr
@@ -10,10 +10,10 @@ LL | | },
= note: `-D clippy::match-single-binding` implied by `-D warnings`
help: consider using `let` statement
|
-LL | Some((iter, _item)) => {
-LL | let (min, max) = iter.size_hint();
-LL | (min.saturating_add(1), max.and_then(|max| max.checked_add(1)))
-LL | },
+LL ~ Some((iter, _item)) => {
+LL + let (min, max) = iter.size_hint();
+LL + (min.saturating_add(1), max.and_then(|max| max.checked_add(1)))
+LL ~ },
|
error: this match could be written as a `let` statement
@@ -26,8 +26,8 @@ LL | | }
|
help: consider using `let` statement
|
-LL | let (a, b) = get_tup();
-LL | println!("a {:?} and b {:?}", a, b);
+LL ~ let (a, b) = get_tup();
+LL + println!("a {:?} and b {:?}", a, b);
|
error: this match could be replaced by its scrutinee and body
@@ -40,8 +40,8 @@ LL | | }
|
help: consider using the scrutinee and body instead
|
-LL | side_effects();
-LL | println!("Side effects");
+LL ~ side_effects();
+LL + println!("Side effects");
|
error: this match could be replaced by its scrutinee and body
@@ -57,11 +57,11 @@ LL | | }
|
help: consider using the scrutinee and body instead
|
-LL | match x {
-LL | 0 => 1,
-LL | _ => 2,
-LL | };
-LL | println!("Single branch");
+LL ~ match x {
+LL + 0 => 1,
+LL + _ => 2,
+LL + };
+LL + println!("Single branch");
|
error: aborting due to 4 previous errors
diff --git a/src/tools/clippy/tests/ui/min_rust_version_attr.stderr b/src/tools/clippy/tests/ui/min_rust_version_attr.stderr
index ddb1e1f3724..a2e4e86ed6b 100644
--- a/src/tools/clippy/tests/ui/min_rust_version_attr.stderr
+++ b/src/tools/clippy/tests/ui/min_rust_version_attr.stderr
@@ -12,8 +12,8 @@ LL | if s.starts_with("hello, ") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s.strip_prefix("hello, ") {
-LL | assert_eq!(<stripped>.to_uppercase(), "WORLD!");
+LL ~ if let Some(<stripped>) = s.strip_prefix("hello, ") {
+LL ~ assert_eq!(<stripped>.to_uppercase(), "WORLD!");
|
error: stripping a prefix manually
@@ -29,8 +29,8 @@ LL | if s.starts_with("hello, ") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try using the `strip_prefix` method
|
-LL | if let Some(<stripped>) = s.strip_prefix("hello, ") {
-LL | assert_eq!(<stripped>.to_uppercase(), "WORLD!");
+LL ~ if let Some(<stripped>) = s.strip_prefix("hello, ") {
+LL ~ assert_eq!(<stripped>.to_uppercase(), "WORLD!");
|
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/mismatched_target_os_unix.stderr b/src/tools/clippy/tests/ui/mismatched_target_os_unix.stderr
index ea39f5b5577..3534b53282f 100644
--- a/src/tools/clippy/tests/ui/mismatched_target_os_unix.stderr
+++ b/src/tools/clippy/tests/ui/mismatched_target_os_unix.stderr
@@ -169,15 +169,15 @@ LL | #[cfg(all(not(any(solaris, linux)), freebsd))]
help: try
|
LL | #[cfg(all(not(any(target_os = "solaris", linux)), freebsd))]
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
help: try
|
LL | #[cfg(all(not(any(solaris, target_os = "linux")), freebsd))]
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
help: try
|
LL | #[cfg(all(not(any(solaris, linux)), target_os = "freebsd"))]
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 17 previous errors
diff --git a/src/tools/clippy/tests/ui/needless_borrow_pat.stderr b/src/tools/clippy/tests/ui/needless_borrow_pat.stderr
index 32913d59f7a..365ecd68d8f 100644
--- a/src/tools/clippy/tests/ui/needless_borrow_pat.stderr
+++ b/src/tools/clippy/tests/ui/needless_borrow_pat.stderr
@@ -15,7 +15,7 @@ LL | Some(ref x) => *x,
help: try this
|
LL | Some(x) => x,
- | ^ ^
+ | ~ ~
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:72:14
@@ -25,9 +25,9 @@ LL | Some(ref x) => {
|
help: try this
|
-LL | Some(x) => {
-LL | f1(x);
+LL ~ Some(x) => {
LL | f1(x);
+LL ~ f1(x);
|
error: this pattern creates a reference to a reference
@@ -50,8 +50,8 @@ LL | let (ref y,) = (&x,);
|
help: try this
|
-LL | let (y,) = (&x,);
-LL | let _: &String = y;
+LL ~ let (y,) = (&x,);
+LL ~ let _: &String = y;
|
error: this pattern creates a reference to a reference
@@ -69,7 +69,7 @@ LL | E::A(ref x) | E::B(ref x) => *x,
help: try this
|
LL | E::A(x) | E::B(x) => x,
- | ^ ^ ^
+ | ~ ~ ~
error: this pattern creates a reference to a reference
--> $DIR/needless_borrow_pat.rs:118:21
@@ -85,9 +85,9 @@ LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
|
help: try this
|
-LL | fn f2<'a>(&x: &&'a String) -> &'a String {
+LL ~ fn f2<'a>(&x: &&'a String) -> &'a String {
LL | let _: &String = x;
-LL | x
+LL ~ x
|
error: this pattern creates a reference to a reference
@@ -104,8 +104,8 @@ LL | fn f(&ref x: &&String) {
|
help: try this
|
-LL | fn f(&x: &&String) {
-LL | let _: &String = x;
+LL ~ fn f(&x: &&String) {
+LL ~ let _: &String = x;
|
error: aborting due to 12 previous errors
diff --git a/src/tools/clippy/tests/ui/needless_collect_indirect.stderr b/src/tools/clippy/tests/ui/needless_collect_indirect.stderr
index f094e182a48..0f5e78f9119 100644
--- a/src/tools/clippy/tests/ui/needless_collect_indirect.stderr
+++ b/src/tools/clippy/tests/ui/needless_collect_indirect.stderr
@@ -9,8 +9,8 @@ LL | indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>(
= note: `-D clippy::needless-collect` implied by `-D warnings`
help: use the original Iterator instead of collecting it and then producing a new one
|
-LL |
-LL | sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
+LL ~
+LL ~ sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
error: avoid using `collect()` when not needed
@@ -23,8 +23,8 @@ LL | indirect_len.len();
|
help: take the original Iterator's count instead of collecting it and finding the length
|
-LL |
-LL | sample.iter().count();
+LL ~
+LL ~ sample.iter().count();
|
error: avoid using `collect()` when not needed
@@ -37,8 +37,8 @@ LL | indirect_empty.is_empty();
|
help: check if the original Iterator has anything instead of collecting it and seeing if it's empty
|
-LL |
-LL | sample.iter().next().is_none();
+LL ~
+LL ~ sample.iter().next().is_none();
|
error: avoid using `collect()` when not needed
@@ -51,8 +51,8 @@ LL | indirect_contains.contains(&&5);
|
help: check if the original Iterator contains an element instead of collecting then checking
|
-LL |
-LL | sample.iter().any(|x| x == &5);
+LL ~
+LL ~ sample.iter().any(|x| x == &5);
|
error: avoid using `collect()` when not needed
@@ -65,8 +65,8 @@ LL | non_copy_contains.contains(&a);
|
help: check if the original Iterator contains an element instead of collecting then checking
|
-LL |
-LL | sample.into_iter().any(|x| x == a);
+LL ~
+LL ~ sample.into_iter().any(|x| x == a);
|
error: avoid using `collect()` when not needed
@@ -79,8 +79,8 @@ LL | buffer.len()
|
help: take the original Iterator's count instead of collecting it and finding the length
|
-LL |
-LL | string.split('/').count()
+LL ~
+LL ~ string.split('/').count()
|
error: avoid using `collect()` when not needed
@@ -93,8 +93,8 @@ LL | indirect_len.len()
|
help: take the original Iterator's count instead of collecting it and finding the length
|
-LL |
-LL | sample.iter().count()
+LL ~
+LL ~ sample.iter().count()
|
error: avoid using `collect()` when not needed
@@ -107,8 +107,8 @@ LL | indirect_len.len()
|
help: take the original Iterator's count instead of collecting it and finding the length
|
-LL |
-LL | sample.iter().count()
+LL ~
+LL ~ sample.iter().count()
|
error: avoid using `collect()` when not needed
@@ -121,8 +121,8 @@ LL | indirect_len.len()
|
help: take the original Iterator's count instead of collecting it and finding the length
|
-LL |
-LL | sample.iter().count()
+LL ~
+LL ~ sample.iter().count()
|
error: aborting due to 9 previous errors
diff --git a/src/tools/clippy/tests/ui/needless_for_each_fixable.stderr b/src/tools/clippy/tests/ui/needless_for_each_fixable.stderr
index 483a5e6d61d..6487e57266c 100644
--- a/src/tools/clippy/tests/ui/needless_for_each_fixable.stderr
+++ b/src/tools/clippy/tests/ui/needless_for_each_fixable.stderr
@@ -9,9 +9,9 @@ LL | | });
= note: `-D clippy::needless-for-each` implied by `-D warnings`
help: try
|
-LL | for elem in v.iter() {
-LL | acc += elem;
-LL | }
+LL ~ for elem in v.iter() {
+LL + acc += elem;
+LL + }
|
error: needless use of `for_each`
@@ -24,9 +24,9 @@ LL | | });
|
help: try
|
-LL | for elem in v.into_iter() {
-LL | acc += elem;
-LL | }
+LL ~ for elem in v.into_iter() {
+LL + acc += elem;
+LL + }
|
error: needless use of `for_each`
@@ -39,9 +39,9 @@ LL | | });
|
help: try
|
-LL | for elem in [1, 2, 3].iter() {
-LL | acc += elem;
-LL | }
+LL ~ for elem in [1, 2, 3].iter() {
+LL + acc += elem;
+LL + }
|
error: needless use of `for_each`
@@ -54,9 +54,9 @@ LL | | });
|
help: try
|
-LL | for (k, v) in hash_map.iter() {
-LL | acc += k + v;
-LL | }
+LL ~ for (k, v) in hash_map.iter() {
+LL + acc += k + v;
+LL + }
|
error: needless use of `for_each`
@@ -69,9 +69,9 @@ LL | | });
|
help: try
|
-LL | for (k, v) in hash_map.iter_mut() {
-LL | acc += *k + *v;
-LL | }
+LL ~ for (k, v) in hash_map.iter_mut() {
+LL + acc += *k + *v;
+LL + }
|
error: needless use of `for_each`
@@ -84,9 +84,9 @@ LL | | });
|
help: try
|
-LL | for k in hash_map.keys() {
-LL | acc += k;
-LL | }
+LL ~ for k in hash_map.keys() {
+LL + acc += k;
+LL + }
|
error: needless use of `for_each`
@@ -99,9 +99,9 @@ LL | | });
|
help: try
|
-LL | for v in hash_map.values() {
-LL | acc += v;
-LL | }
+LL ~ for v in hash_map.values() {
+LL + acc += v;
+LL + }
|
error: needless use of `for_each`
@@ -114,9 +114,9 @@ LL | | });
|
help: try
|
-LL | for elem in my_vec().iter() {
-LL | acc += elem;
-LL | }
+LL ~ for elem in my_vec().iter() {
+LL + acc += elem;
+LL + }
|
error: aborting due to 8 previous errors
diff --git a/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr b/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
index 8c4507d2328..f607e0a430e 100644
--- a/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
+++ b/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
@@ -13,17 +13,17 @@ LL | | });
= note: `-D clippy::needless-for-each` implied by `-D warnings`
help: try
|
-LL | for v in v.iter() {
-LL | if *v == 10 {
-LL | return;
-LL | } else {
-LL | println!("{}", v);
-LL | }
+LL ~ for v in v.iter() {
+LL + if *v == 10 {
+LL + return;
+LL + } else {
+LL + println!("{}", v);
+LL + }
...
help: ...and replace `return` with `continue`
|
LL | continue;
- | ^^^^^^^^
+ | ~~~~~~~~
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr
index 9aa783bf904..2f61ba241c4 100644
--- a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr
+++ b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr
@@ -63,11 +63,11 @@ LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
help: consider changing the type to
|
LL | fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
- | ^^^^
+ | ~~~~
help: change `t.clone()` to
|
LL | let _ = t.to_string();
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:81:40
@@ -84,11 +84,11 @@ LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
help: consider changing the type to
|
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {
- | ^^^^^^
+ | ~~~~~~
help: change `v.clone()` to
|
LL | let _ = v.to_owned();
- | ^^^^^^^^^^^^
+ | ~~~~~~~~~~~~
error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:94:12
diff --git a/src/tools/clippy/tests/ui/needless_range_loop.stderr b/src/tools/clippy/tests/ui/needless_range_loop.stderr
index c898cd64a93..a86cc69dfc5 100644
--- a/src/tools/clippy/tests/ui/needless_range_loop.stderr
+++ b/src/tools/clippy/tests/ui/needless_range_loop.stderr
@@ -8,7 +8,7 @@ LL | for i in 0..vec.len() {
help: consider using an iterator
|
LL | for <item> in &vec {
- | ^^^^^^ ^^^^
+ | ~~~~~~ ~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:19:14
@@ -19,7 +19,7 @@ LL | for i in 0..vec.len() {
help: consider using an iterator
|
LL | for <item> in &vec {
- | ^^^^^^ ^^^^
+ | ~~~~~~ ~~~~
error: the loop variable `j` is only used to index `STATIC`
--> $DIR/needless_range_loop.rs:24:14
@@ -30,7 +30,7 @@ LL | for j in 0..4 {
help: consider using an iterator
|
LL | for <item> in &STATIC {
- | ^^^^^^ ^^^^^^^
+ | ~~~~~~ ~~~~~~~
error: the loop variable `j` is only used to index `CONST`
--> $DIR/needless_range_loop.rs:28:14
@@ -41,7 +41,7 @@ LL | for j in 0..4 {
help: consider using an iterator
|
LL | for <item> in &CONST {
- | ^^^^^^ ^^^^^^
+ | ~~~~~~ ~~~~~~
error: the loop variable `i` is used to index `vec`
--> $DIR/needless_range_loop.rs:32:14
@@ -52,7 +52,7 @@ LL | for i in 0..vec.len() {
help: consider using an iterator
|
LL | for (i, <item>) in vec.iter().enumerate() {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec2`
--> $DIR/needless_range_loop.rs:40:14
@@ -63,7 +63,7 @@ LL | for i in 0..vec.len() {
help: consider using an iterator
|
LL | for <item> in vec2.iter().take(vec.len()) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:44:14
@@ -74,7 +74,7 @@ LL | for i in 5..vec.len() {
help: consider using an iterator
|
LL | for <item> in vec.iter().skip(5) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:48:14
@@ -85,7 +85,7 @@ LL | for i in 0..MAX_LEN {
help: consider using an iterator
|
LL | for <item> in vec.iter().take(MAX_LEN) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:52:14
@@ -96,7 +96,7 @@ LL | for i in 0..=MAX_LEN {
help: consider using an iterator
|
LL | for <item> in vec.iter().take(MAX_LEN + 1) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:56:14
@@ -107,7 +107,7 @@ LL | for i in 5..10 {
help: consider using an iterator
|
LL | for <item> in vec.iter().take(10).skip(5) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:60:14
@@ -118,7 +118,7 @@ LL | for i in 5..=10 {
help: consider using an iterator
|
LL | for <item> in vec.iter().take(10 + 1).skip(5) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is used to index `vec`
--> $DIR/needless_range_loop.rs:64:14
@@ -129,7 +129,7 @@ LL | for i in 5..vec.len() {
help: consider using an iterator
|
LL | for (i, <item>) in vec.iter().enumerate().skip(5) {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is used to index `vec`
--> $DIR/needless_range_loop.rs:68:14
@@ -140,7 +140,7 @@ LL | for i in 5..10 {
help: consider using an iterator
|
LL | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is used to index `vec`
--> $DIR/needless_range_loop.rs:73:14
@@ -151,7 +151,7 @@ LL | for i in 0..vec.len() {
help: consider using an iterator
|
LL | for (i, <item>) in vec.iter_mut().enumerate() {
- | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 14 previous errors
diff --git a/src/tools/clippy/tests/ui/needless_range_loop2.stderr b/src/tools/clippy/tests/ui/needless_range_loop2.stderr
index 2e1f0fd0299..1e6ec5e667a 100644
--- a/src/tools/clippy/tests/ui/needless_range_loop2.stderr
+++ b/src/tools/clippy/tests/ui/needless_range_loop2.stderr
@@ -8,7 +8,7 @@ LL | for i in 3..10 {
help: consider using an iterator
|
LL | for <item> in ns.iter().take(10).skip(3) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `ms`
--> $DIR/needless_range_loop2.rs:31:14
@@ -19,7 +19,7 @@ LL | for i in 0..ms.len() {
help: consider using an iterator
|
LL | for <item> in &mut ms {
- | ^^^^^^ ^^^^^^^
+ | ~~~~~~ ~~~~~~~
error: the loop variable `i` is only used to index `ms`
--> $DIR/needless_range_loop2.rs:37:14
@@ -30,7 +30,7 @@ LL | for i in 0..ms.len() {
help: consider using an iterator
|
LL | for <item> in &mut ms {
- | ^^^^^^ ^^^^^^^
+ | ~~~~~~ ~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop2.rs:61:14
@@ -41,7 +41,7 @@ LL | for i in x..x + 4 {
help: consider using an iterator
|
LL | for <item> in vec.iter_mut().skip(x).take(4) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop2.rs:68:14
@@ -52,7 +52,7 @@ LL | for i in x..=x + 4 {
help: consider using an iterator
|
LL | for <item> in vec.iter_mut().skip(x).take(4 + 1) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `arr`
--> $DIR/needless_range_loop2.rs:74:14
@@ -63,7 +63,7 @@ LL | for i in 0..3 {
help: consider using an iterator
|
LL | for <item> in &arr {
- | ^^^^^^ ^^^^
+ | ~~~~~~ ~~~~
error: the loop variable `i` is only used to index `arr`
--> $DIR/needless_range_loop2.rs:78:14
@@ -74,7 +74,7 @@ LL | for i in 0..2 {
help: consider using an iterator
|
LL | for <item> in arr.iter().take(2) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~
error: the loop variable `i` is only used to index `arr`
--> $DIR/needless_range_loop2.rs:82:14
@@ -85,7 +85,7 @@ LL | for i in 1..3 {
help: consider using an iterator
|
LL | for <item> in arr.iter().skip(1) {
- | ^^^^^^ ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~ ~~~~~~~~~~~~~~~~~~
error: aborting due to 8 previous errors
diff --git a/src/tools/clippy/tests/ui/new_without_default.stderr b/src/tools/clippy/tests/ui/new_without_default.stderr
index 7c964000807..14ddb66f232 100644
--- a/src/tools/clippy/tests/ui/new_without_default.stderr
+++ b/src/tools/clippy/tests/ui/new_without_default.stderr
@@ -9,11 +9,11 @@ LL | | }
= note: `-D clippy::new-without-default` implied by `-D warnings`
help: try adding this
|
-LL | impl Default for Foo {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
+LL + impl Default for Foo {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
|
error: you should consider adding a `Default` implementation for `Bar`
@@ -26,11 +26,11 @@ LL | | }
|
help: try adding this
|
-LL | impl Default for Bar {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
+LL + impl Default for Bar {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
|
error: you should consider adding a `Default` implementation for `LtKo<'c>`
@@ -43,11 +43,11 @@ LL | | }
|
help: try adding this
|
-LL | impl<'c> Default for LtKo<'c> {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
+LL + impl<'c> Default for LtKo<'c> {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
|
error: you should consider adding a `Default` implementation for `NewNotEqualToDerive`
@@ -60,11 +60,11 @@ LL | | }
|
help: try adding this
|
-LL | impl Default for NewNotEqualToDerive {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
+LL + impl Default for NewNotEqualToDerive {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
|
error: you should consider adding a `Default` implementation for `FooGenerics<T>`
@@ -77,11 +77,11 @@ LL | | }
|
help: try adding this
|
-LL | impl<T> Default for FooGenerics<T> {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
+LL + impl<T> Default for FooGenerics<T> {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
|
error: you should consider adding a `Default` implementation for `BarGenerics<T>`
@@ -94,11 +94,11 @@ LL | | }
|
help: try adding this
|
-LL | impl<T: Copy> Default for BarGenerics<T> {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
+LL + impl<T: Copy> Default for BarGenerics<T> {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
|
error: you should consider adding a `Default` implementation for `Foo<T>`
@@ -111,12 +111,12 @@ LL | | }
|
help: try adding this
|
-LL | impl<T> Default for Foo<T> {
-LL | fn default() -> Self {
-LL | Self::new()
-LL | }
-LL | }
-LL |
+LL ~ impl<T> Default for Foo<T> {
+LL + fn default() -> Self {
+LL + Self::new()
+LL + }
+LL + }
+LL +
...
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.stderr b/src/tools/clippy/tests/ui/nonminimal_bool.stderr
index d34d106cb2f..1d39bce935d 100644
--- a/src/tools/clippy/tests/ui/nonminimal_bool.stderr
+++ b/src/tools/clippy/tests/ui/nonminimal_bool.stderr
@@ -51,9 +51,9 @@ LL | let _ = a == b && c == 5 && a == b;
help: try
|
LL | let _ = a == b && c == 5;
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
LL | let _ = !(a != b || c != 5);
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> $DIR/nonminimal_bool.rs:28:13
@@ -64,9 +64,9 @@ LL | let _ = a == b || c == 5 || a == b;
help: try
|
LL | let _ = a == b || c == 5;
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
LL | let _ = !(a != b && c != 5);
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> $DIR/nonminimal_bool.rs:29:13
@@ -77,9 +77,9 @@ LL | let _ = a == b && c == 5 && b == a;
help: try
|
LL | let _ = a == b && c == 5;
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
LL | let _ = !(a != b || c != 5);
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> $DIR/nonminimal_bool.rs:30:13
@@ -90,9 +90,9 @@ LL | let _ = a != b || !(a != b || c == d);
help: try
|
LL | let _ = a != b || c != d;
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
LL | let _ = !(a == b && c == d);
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> $DIR/nonminimal_bool.rs:31:13
@@ -103,9 +103,9 @@ LL | let _ = a != b && !(a != b && c == d);
help: try
|
LL | let _ = a != b && c != d;
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
LL | let _ = !(a == b || c == d);
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
error: aborting due to 12 previous errors
diff --git a/src/tools/clippy/tests/ui/op_ref.stderr b/src/tools/clippy/tests/ui/op_ref.stderr
index a3a9adcc483..821099d8779 100644
--- a/src/tools/clippy/tests/ui/op_ref.stderr
+++ b/src/tools/clippy/tests/ui/op_ref.stderr
@@ -8,7 +8,7 @@ LL | let foo = &5 - &6;
help: use the values directly
|
LL | let foo = 5 - 6;
- | ^ ^
+ | ~ ~
error: taken reference of right operand
--> $DIR/op_ref.rs:57:13
diff --git a/src/tools/clippy/tests/ui/option_if_let_else.stderr b/src/tools/clippy/tests/ui/option_if_let_else.stderr
index 4ebb068d22e..099e49ef8e3 100644
--- a/src/tools/clippy/tests/ui/option_if_let_else.stderr
+++ b/src/tools/clippy/tests/ui/option_if_let_else.stderr
@@ -36,10 +36,10 @@ LL | | };
|
help: try
|
-LL | let _ = num.as_mut().map_or(&mut 0, |s| {
-LL | *s += 1;
-LL | s
-LL | });
+LL ~ let _ = num.as_mut().map_or(&mut 0, |s| {
+LL + *s += 1;
+LL + s
+LL ~ });
|
error: use Option::map_or instead of an if let/else
@@ -62,10 +62,10 @@ LL | | };
|
help: try
|
-LL | let _ = num.map_or(0, |mut s| {
-LL | s += 1;
-LL | s
-LL | });
+LL ~ let _ = num.map_or(0, |mut s| {
+LL + s += 1;
+LL + s
+LL ~ });
|
error: use Option::map_or instead of an if let/else
@@ -82,10 +82,10 @@ LL | | };
|
help: try
|
-LL | let _ = num.as_mut().map_or(&mut 0, |s| {
-LL | *s += 1;
-LL | s
-LL | });
+LL ~ let _ = num.as_mut().map_or(&mut 0, |s| {
+LL + *s += 1;
+LL + s
+LL ~ });
|
error: use Option::map_or instead of an if let/else
@@ -101,10 +101,10 @@ LL | | }
|
help: try
|
-LL | arg.map_or(13, |x| {
-LL | let y = x * x;
-LL | y * y
-LL | })
+LL ~ arg.map_or(13, |x| {
+LL + let y = x * x;
+LL + y * y
+LL + })
|
error: use Option::map_or_else instead of an if let/else
@@ -134,12 +134,12 @@ LL | | };
|
help: try
|
-LL | let _ = arg.map_or_else(|| {
-LL | let mut y = 1;
-LL | y = (y + 2 / y) / 2;
-LL | y = (y + 2 / y) / 2;
-LL | y
-LL | }, |x| x * x * x * x);
+LL ~ let _ = arg.map_or_else(|| {
+LL + let mut y = 1;
+LL + y = (y + 2 / y) / 2;
+LL + y = (y + 2 / y) / 2;
+LL + y
+LL ~ }, |x| x * x * x * x);
|
error: use Option::map_or instead of an if let/else
diff --git a/src/tools/clippy/tests/ui/option_map_or_none.stderr b/src/tools/clippy/tests/ui/option_map_or_none.stderr
index 1cba29412b8..27d68b85e6f 100644
--- a/src/tools/clippy/tests/ui/option_map_or_none.stderr
+++ b/src/tools/clippy/tests/ui/option_map_or_none.stderr
@@ -17,9 +17,9 @@ LL | | });
|
help: try using `and_then` instead
|
-LL | let _ = opt.and_then(|x| {
-LL | Some(x + 1)
-LL | });
+LL ~ let _ = opt.and_then(|x| {
+LL + Some(x + 1)
+LL ~ });
|
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/print_literal.stderr b/src/tools/clippy/tests/ui/print_literal.stderr
index 54a4084c89e..a10cac04411 100644
--- a/src/tools/clippy/tests/ui/print_literal.stderr
+++ b/src/tools/clippy/tests/ui/print_literal.stderr
@@ -7,8 +7,9 @@ LL | print!("Hello {}", "world");
= note: `-D clippy::print-literal` implied by `-D warnings`
help: try this
|
-LL | print!("Hello world");
- | ^^^^^--
+LL - print!("Hello {}", "world");
+LL + print!("Hello world");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:26:36
@@ -18,8 +19,9 @@ LL | println!("Hello {} {}", world, "world");
|
help: try this
|
-LL | println!("Hello {} world", world);
- | ^^^^^ --
+LL - println!("Hello {} {}", world, "world");
+LL + println!("Hello {} world", world);
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:27:26
@@ -29,8 +31,9 @@ LL | println!("Hello {}", "world");
|
help: try this
|
-LL | println!("Hello world");
- | ^^^^^--
+LL - println!("Hello {}", "world");
+LL + println!("Hello world");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:32:25
@@ -40,8 +43,9 @@ LL | println!("{0} {1}", "hello", "world");
|
help: try this
|
-LL | println!("hello {1}", "world");
- | ^^^^^ --
+LL - println!("{0} {1}", "hello", "world");
+LL + println!("hello {1}", "world");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:32:34
@@ -51,8 +55,9 @@ LL | println!("{0} {1}", "hello", "world");
|
help: try this
|
-LL | println!("{0} world", "hello");
- | ^^^^^ --
+LL - println!("{0} {1}", "hello", "world");
+LL + println!("{0} world", "hello");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:33:25
@@ -62,8 +67,9 @@ LL | println!("{1} {0}", "hello", "world");
|
help: try this
|
-LL | println!("{1} hello", "world");
- | ^^^^^--
+LL - println!("{1} {0}", "hello", "world");
+LL + println!("{1} hello", "world");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:33:34
@@ -73,8 +79,9 @@ LL | println!("{1} {0}", "hello", "world");
|
help: try this
|
-LL | println!("world {0}", "hello");
- | ^^^^^ --
+LL - println!("{1} {0}", "hello", "world");
+LL + println!("world {0}", "hello");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:36:29
@@ -84,8 +91,9 @@ LL | println!("{foo} {bar}", foo = "hello", bar = "world");
|
help: try this
|
-LL | println!("hello {bar}", bar = "world");
- | ^^^^^ --
+LL - println!("{foo} {bar}", foo = "hello", bar = "world");
+LL + println!("hello {bar}", bar = "world");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:36:44
@@ -95,8 +103,9 @@ LL | println!("{foo} {bar}", foo = "hello", bar = "world");
|
help: try this
|
-LL | println!("{foo} world", foo = "hello");
- | ^^^^^ --
+LL - println!("{foo} {bar}", foo = "hello", bar = "world");
+LL + println!("{foo} world", foo = "hello");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:37:29
@@ -106,8 +115,9 @@ LL | println!("{bar} {foo}", foo = "hello", bar = "world");
|
help: try this
|
-LL | println!("{bar} hello", bar = "world");
- | ^^^^^--
+LL - println!("{bar} {foo}", foo = "hello", bar = "world");
+LL + println!("{bar} hello", bar = "world");
+ |
error: literal with an empty format string
--> $DIR/print_literal.rs:37:44
@@ -117,8 +127,9 @@ LL | println!("{bar} {foo}", foo = "hello", bar = "world");
|
help: try this
|
-LL | println!("world {foo}", foo = "hello");
- | ^^^^^ --
+LL - println!("{bar} {foo}", foo = "hello", bar = "world");
+LL + println!("world {foo}", foo = "hello");
+ |
error: aborting due to 11 previous errors
diff --git a/src/tools/clippy/tests/ui/print_with_newline.stderr b/src/tools/clippy/tests/ui/print_with_newline.stderr
index 54b3ad75b31..d409bee30ec 100644
--- a/src/tools/clippy/tests/ui/print_with_newline.stderr
+++ b/src/tools/clippy/tests/ui/print_with_newline.stderr
@@ -7,8 +7,9 @@ LL | print!("Hello/n");
= note: `-D clippy::print-with-newline` implied by `-D warnings`
help: use `println!` instead
|
-LL | println!("Hello");
- | ^^^^^^^ --
+LL - print!("Hello/n");
+LL + println!("Hello");
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:9:5
@@ -18,8 +19,9 @@ LL | print!("Hello {}/n", "world");
|
help: use `println!` instead
|
-LL | println!("Hello {}", "world");
- | ^^^^^^^ --
+LL - print!("Hello {}/n", "world");
+LL + println!("Hello {}", "world");
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:10:5
@@ -29,8 +31,9 @@ LL | print!("Hello {} {}/n", "world", "#2");
|
help: use `println!` instead
|
-LL | println!("Hello {} {}", "world", "#2");
- | ^^^^^^^ --
+LL - print!("Hello {} {}/n", "world", "#2");
+LL + println!("Hello {} {}", "world", "#2");
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:11:5
@@ -40,8 +43,9 @@ LL | print!("{}/n", 1265);
|
help: use `println!` instead
|
-LL | println!("{}", 1265);
- | ^^^^^^^ --
+LL - print!("{}/n", 1265);
+LL + println!("{}", 1265);
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:12:5
@@ -51,8 +55,9 @@ LL | print!("/n");
|
help: use `println!` instead
|
-LL | println!();
- | ^^^^^^^ --
+LL - print!("/n");
+LL + println!();
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:31:5
@@ -62,8 +67,9 @@ LL | print!("//n"); // should fail
|
help: use `println!` instead
|
-LL | println!("/"); // should fail
- | ^^^^^^^ --
+LL - print!("//n"); // should fail
+LL + println!("/"); // should fail
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:38:5
@@ -76,8 +82,8 @@ LL | | );
|
help: use `println!` instead
|
-LL | println!(
-LL | ""
+LL ~ println!(
+LL ~ ""
|
error: using `print!()` with a format string that ends in a single newline
@@ -91,8 +97,8 @@ LL | | );
|
help: use `println!` instead
|
-LL | println!(
-LL | r""
+LL ~ println!(
+LL ~ r""
|
error: using `print!()` with a format string that ends in a single newline
@@ -103,8 +109,9 @@ LL | print!("/r/n"); //~ ERROR
|
help: use `println!` instead
|
-LL | println!("/r"); //~ ERROR
- | ^^^^^^^ --
+LL - print!("/r/n"); //~ ERROR
+LL + println!("/r"); //~ ERROR
+ |
error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:51:5
@@ -114,8 +121,9 @@ LL | print!("foo/rbar/n") // ~ ERROR
|
help: use `println!` instead
|
-LL | println!("foo/rbar") // ~ ERROR
- | ^^^^^^^ --
+LL - print!("foo/rbar/n") // ~ ERROR
+LL + println!("foo/rbar") // ~ ERROR
+ |
error: aborting due to 10 previous errors
diff --git a/src/tools/clippy/tests/ui/ptr_arg.stderr b/src/tools/clippy/tests/ui/ptr_arg.stderr
index d302b16d4b7..64594eb870c 100644
--- a/src/tools/clippy/tests/ui/ptr_arg.stderr
+++ b/src/tools/clippy/tests/ui/ptr_arg.stderr
@@ -33,11 +33,11 @@ LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
help: change this to
|
LL | fn cloned(x: &[u8]) -> Vec<u8> {
- | ^^^^^
+ | ~~~~~
help: change `x.clone()` to
|
LL | let e = x.to_owned();
- | ^^^^^^^^^^^^
+ | ~~~~~~~~~~~~
help: change `x.clone()` to
|
LL | x.to_owned()
@@ -52,15 +52,15 @@ LL | fn str_cloned(x: &String) -> String {
help: change this to
|
LL | fn str_cloned(x: &str) -> String {
- | ^^^^
+ | ~~~~
help: change `x.clone()` to
|
LL | let a = x.to_string();
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
help: change `x.clone()` to
|
LL | let b = x.to_string();
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
help: change `x.clone()` to
|
LL | x.to_string()
@@ -75,15 +75,15 @@ LL | fn path_cloned(x: &PathBuf) -> PathBuf {
help: change this to
|
LL | fn path_cloned(x: &Path) -> PathBuf {
- | ^^^^^
+ | ~~~~~
help: change `x.clone()` to
|
LL | let a = x.to_path_buf();
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
help: change `x.clone()` to
|
LL | let b = x.to_path_buf();
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
help: change `x.clone()` to
|
LL | x.to_path_buf()
@@ -98,15 +98,15 @@ LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
help: change this to
|
LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
- | ^^^^
+ | ~~~~
help: change `y.clone()` to
|
LL | let b = y.to_string();
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
help: change `y.as_str()` to
|
LL | let c = y;
- | ^
+ | ~
error: using a reference to `Cow` is not recommended
--> $DIR/ptr_arg.rs:90:25
@@ -123,15 +123,15 @@ LL | fn foo_vec(vec: &Vec<u8>) {
help: change this to
|
LL | fn foo_vec(vec: &[u8]) {
- | ^^^^^
+ | ~~~~~
help: change `vec.clone()` to
|
LL | let _ = vec.to_owned().pop();
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
help: change `vec.clone()` to
|
LL | let _ = vec.to_owned().clone();
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:148:23
@@ -142,15 +142,15 @@ LL | fn foo_path(path: &PathBuf) {
help: change this to
|
LL | fn foo_path(path: &Path) {
- | ^^^^^
+ | ~~~~~
help: change `path.clone()` to
|
LL | let _ = path.to_path_buf().pop();
- | ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~
help: change `path.clone()` to
|
LL | let _ = path.to_path_buf().clone();
- | ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~
error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:153:21
@@ -161,15 +161,15 @@ LL | fn foo_str(str: &PathBuf) {
help: change this to
|
LL | fn foo_str(str: &Path) {
- | ^^^^^
+ | ~~~~~
help: change `str.clone()` to
|
LL | let _ = str.to_path_buf().pop();
- | ^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~
help: change `str.clone()` to
|
LL | let _ = str.to_path_buf().clone();
- | ^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~
error: aborting due to 12 previous errors
diff --git a/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr b/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr
index 00aeff4fefa..eb36cd516a2 100644
--- a/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr
+++ b/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr
@@ -8,7 +8,7 @@ LL | Some(ref x) => x,
help: try this
|
LL | Some(x) => &x,
- | ^ ^^
+ | ~ ~~
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:37:14
@@ -18,10 +18,10 @@ LL | Some(ref x) => {
|
help: try this
|
-LL | Some(x) => {
+LL ~ Some(x) => {
LL | f1(x);
-LL | f1(x);
-LL | &x
+LL ~ f1(x);
+LL ~ &x
|
error: this pattern creates a reference to a reference
@@ -33,7 +33,7 @@ LL | Some(ref x) => m2!(x),
help: try this
|
LL | Some(x) => m2!(&x),
- | ^ ^^
+ | ~ ~~
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:52:15
@@ -43,8 +43,8 @@ LL | let _ = |&ref x: &&String| {
|
help: try this
|
-LL | let _ = |&x: &&String| {
-LL | let _: &&String = &x;
+LL ~ let _ = |&x: &&String| {
+LL ~ let _: &&String = &x;
|
error: this pattern creates a reference to a reference
@@ -55,9 +55,9 @@ LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
|
help: try this
|
-LL | fn f2<'a>(&x: &&'a String) -> &'a String {
-LL | let _: &&String = &x;
-LL | x
+LL ~ fn f2<'a>(&x: &&'a String) -> &'a String {
+LL ~ let _: &&String = &x;
+LL ~ x
|
error: this pattern creates a reference to a reference
@@ -68,8 +68,8 @@ LL | fn f(&ref x: &&String) {
|
help: try this
|
-LL | fn f(&x: &&String) {
-LL | let _: &&String = &x;
+LL ~ fn f(&x: &&String) {
+LL ~ let _: &&String = &x;
|
error: this pattern creates a reference to a reference
@@ -80,8 +80,8 @@ LL | fn f(&ref x: &&String) {
|
help: try this
|
-LL | fn f(&x: &&String) {
-LL | let _: &&String = &x;
+LL ~ fn f(&x: &&String) {
+LL ~ let _: &&String = &x;
|
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr b/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr
index de83c4f3d63..2d1bfe62c92 100644
--- a/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr
+++ b/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr
@@ -8,7 +8,7 @@ LL | (42..=21).for_each(|x| println!("{}", x));
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | (21..=42).rev().for_each(|x| println!("{}", x));
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:10:13
@@ -19,7 +19,7 @@ LL | let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>(
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | let _ = (21..ANSWER).rev().filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>();
- | ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:12:14
@@ -30,7 +30,7 @@ LL | for _ in -21..=-42 {}
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for _ in (-42..=-21).rev() {}
- | ^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:13:14
@@ -41,7 +41,7 @@ LL | for _ in 42u32..21u32 {}
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for _ in (21u32..42u32).rev() {}
- | ^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors
diff --git a/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr b/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr
index e89e040a0ff..a135da488ff 100644
--- a/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr
+++ b/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr
@@ -8,7 +8,7 @@ LL | for i in 10..0 {
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for i in (0..10).rev() {
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_loops_fixable.rs:11:14
@@ -19,7 +19,7 @@ LL | for i in 10..=0 {
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for i in (0..=10).rev() {
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_loops_fixable.rs:15:14
@@ -30,7 +30,7 @@ LL | for i in MAX_LEN..0 {
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for i in (0..MAX_LEN).rev() {
- | ^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_loops_fixable.rs:34:14
@@ -41,7 +41,7 @@ LL | for i in (10..0).map(|x| x * 2) {
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for i in (0..10).rev().map(|x| x * 2) {
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_loops_fixable.rs:39:14
@@ -52,7 +52,7 @@ LL | for i in 10..5 + 4 {
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for i in (5 + 4..10).rev() {
- | ^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_loops_fixable.rs:43:14
@@ -63,7 +63,7 @@ LL | for i in (5 + 2)..(3 - 1) {
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for i in ((3 - 1)..(5 + 2)).rev() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 6 previous errors
diff --git a/src/tools/clippy/tests/ui/single_element_loop.stderr b/src/tools/clippy/tests/ui/single_element_loop.stderr
index 0e35a33ded5..f52ca8c5a9b 100644
--- a/src/tools/clippy/tests/ui/single_element_loop.stderr
+++ b/src/tools/clippy/tests/ui/single_element_loop.stderr
@@ -9,10 +9,10 @@ LL | | }
= note: `-D clippy::single-element-loop` implied by `-D warnings`
help: try
|
-LL | {
-LL | let item = &item1;
-LL | println!("{}", item);
-LL | }
+LL ~ {
+LL + let item = &item1;
+LL + println!("{}", item);
+LL + }
|
error: for loop over a single element
@@ -25,10 +25,10 @@ LL | | }
|
help: try
|
-LL | {
-LL | let item = &item1;
-LL | println!("{:?}", item);
-LL | }
+LL ~ {
+LL + let item = &item1;
+LL + println!("{:?}", item);
+LL + }
|
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/single_match.stderr b/src/tools/clippy/tests/ui/single_match.stderr
index 9ef2a8668a6..c261b5111c8 100644
--- a/src/tools/clippy/tests/ui/single_match.stderr
+++ b/src/tools/clippy/tests/ui/single_match.stderr
@@ -12,9 +12,9 @@ LL | | };
= note: `-D clippy::single-match` implied by `-D warnings`
help: try this
|
-LL | if let Some(y) = x {
-LL | println!("{:?}", y);
-LL | };
+LL ~ if let Some(y) = x {
+LL + println!("{:?}", y);
+LL ~ };
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
diff --git a/src/tools/clippy/tests/ui/single_match_else.stderr b/src/tools/clippy/tests/ui/single_match_else.stderr
index 20be4fa226c..c61d80a905c 100644
--- a/src/tools/clippy/tests/ui/single_match_else.stderr
+++ b/src/tools/clippy/tests/ui/single_match_else.stderr
@@ -13,10 +13,10 @@ LL | | }
= note: `-D clippy::single-match-else` implied by `-D warnings`
help: try this
|
-LL | if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else {
-LL | let x = 5;
-LL | None
-LL | }
+LL ~ if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else {
+LL + let x = 5;
+LL + None
+LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
@@ -33,10 +33,10 @@ LL | | }
|
help: try this
|
-LL | if let Some(a) = Some(1) { println!("${:?}", a) } else {
-LL | println!("else block");
-LL | return
-LL | }
+LL ~ if let Some(a) = Some(1) { println!("${:?}", a) } else {
+LL + println!("else block");
+LL + return
+LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
@@ -53,10 +53,10 @@ LL | | }
|
help: try this
|
-LL | if let Some(a) = Some(1) { println!("${:?}", a) } else {
-LL | println!("else block");
-LL | return;
-LL | }
+LL ~ if let Some(a) = Some(1) { println!("${:?}", a) } else {
+LL + println!("else block");
+LL + return;
+LL + }
|
error: aborting due to 3 previous errors
diff --git a/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr b/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr
index a212bd327c3..e0ca511557c 100644
--- a/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr
+++ b/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr
@@ -8,7 +8,7 @@ LL | let len = unsafe { libc::strlen(cstring.as_ptr()) };
help: try this (you might also need to get rid of `unsafe` block in some cases):
|
LL | let len = unsafe { cstring.as_bytes().len() };
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~
error: using `libc::strlen` on a `CString` or `CStr` value
--> $DIR/strlen_on_c_strings.rs:15:24
@@ -19,7 +19,7 @@ LL | let len = unsafe { libc::strlen(cstr.as_ptr()) };
help: try this (you might also need to get rid of `unsafe` block in some cases):
|
LL | let len = unsafe { cstr.to_bytes().len() };
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/unit_arg.stderr b/src/tools/clippy/tests/ui/unit_arg.stderr
index 8155c4ae110..5cfb367a7be 100644
--- a/src/tools/clippy/tests/ui/unit_arg.stderr
+++ b/src/tools/clippy/tests/ui/unit_arg.stderr
@@ -13,10 +13,10 @@ LL | 1
|
help: or move the expression in front of the call and replace it with the unit literal `()`
|
-LL | {
-LL | 1;
-LL | };
-LL | foo(());
+LL ~ {
+LL + 1;
+LL + };
+LL ~ foo(());
|
error: passing a unit value to a function
@@ -27,8 +27,8 @@ LL | foo(foo(1));
|
help: move the expression in front of the call and replace it with the unit literal `()`
|
-LL | foo(1);
-LL | foo(());
+LL ~ foo(1);
+LL ~ foo(());
|
error: passing a unit value to a function
@@ -46,11 +46,11 @@ LL | foo(2)
|
help: or move the expression in front of the call and replace it with the unit literal `()`
|
-LL | {
-LL | foo(1);
-LL | foo(2);
-LL | };
-LL | foo(());
+LL ~ {
+LL + foo(1);
+LL + foo(2);
+LL + };
+LL ~ foo(());
|
error: passing a unit value to a function
@@ -67,10 +67,10 @@ LL | 1
|
help: or move the expression in front of the call and replace it with the unit literal `()`
|
-LL | {
-LL | 1;
-LL | };
-LL | b.bar(());
+LL ~ {
+LL + 1;
+LL + };
+LL ~ b.bar(());
|
error: passing unit values to a function
@@ -81,9 +81,9 @@ LL | taking_multiple_units(foo(0), foo(1));
|
help: move the expressions in front of the call and replace them with the unit literal `()`
|
-LL | foo(0);
-LL | foo(1);
-LL | taking_multiple_units((), ());
+LL ~ foo(0);
+LL + foo(1);
+LL ~ taking_multiple_units((), ());
|
error: passing unit values to a function
@@ -101,12 +101,12 @@ LL | foo(2)
|
help: or move the expressions in front of the call and replace them with the unit literal `()`
|
-LL | foo(0);
-LL | {
-LL | foo(1);
-LL | foo(2);
-LL | };
-LL | taking_multiple_units((), ());
+LL ~ foo(0);
+LL + {
+LL + foo(1);
+LL + foo(2);
+LL + };
+LL ~ taking_multiple_units((), ());
|
error: passing unit values to a function
@@ -131,12 +131,12 @@ LL | foo(3)
|
help: or move the expressions in front of the call and replace them with the unit literal `()`
|
-LL | {
-LL | foo(0);
-LL | foo(1);
-LL | };
-LL | {
-LL | foo(2);
+LL ~ {
+LL + foo(0);
+LL + foo(1);
+LL + };
+LL + {
+LL + foo(2);
...
error: passing a unit value to a function
@@ -147,10 +147,10 @@ LL | None.or(Some(foo(2)));
|
help: move the expression in front of the call and replace it with the unit literal `()`
|
-LL | None.or({
-LL | foo(2);
-LL | Some(())
-LL | });
+LL ~ None.or({
+LL + foo(2);
+LL + Some(())
+LL ~ });
|
error: passing a unit value to a function
@@ -161,8 +161,8 @@ LL | foo(foo(()));
|
help: move the expression in front of the call and replace it with the unit literal `()`
|
-LL | foo(());
-LL | foo(());
+LL ~ foo(());
+LL ~ foo(());
|
error: passing a unit value to a function
@@ -173,8 +173,8 @@ LL | Some(foo(1))
|
help: move the expression in front of the call and replace it with the unit literal `()`
|
-LL | foo(1);
-LL | Some(())
+LL ~ foo(1);
+LL + Some(())
|
error: aborting due to 10 previous errors
diff --git a/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr b/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr
index 456b12a2c6b..39072c9a8cc 100644
--- a/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr
+++ b/src/tools/clippy/tests/ui/unit_arg_empty_blocks.stderr
@@ -24,8 +24,8 @@ LL | taking_two_units({}, foo(0));
|
help: move the expression in front of the call and replace it with the unit literal `()`
|
-LL | foo(0);
-LL | taking_two_units((), ());
+LL ~ foo(0);
+LL ~ taking_two_units((), ());
|
error: passing unit values to a function
@@ -36,9 +36,9 @@ LL | taking_three_units({}, foo(0), foo(1));
|
help: move the expressions in front of the call and replace them with the unit literal `()`
|
-LL | foo(0);
-LL | foo(1);
-LL | taking_three_units((), (), ());
+LL ~ foo(0);
+LL + foo(1);
+LL ~ taking_three_units((), (), ());
|
error: aborting due to 4 previous errors
diff --git a/src/tools/clippy/tests/ui/unnecessary_clone.stderr b/src/tools/clippy/tests/ui/unnecessary_clone.stderr
index 9df1ae56867..94cc7777aca 100644
--- a/src/tools/clippy/tests/ui/unnecessary_clone.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_clone.stderr
@@ -54,11 +54,11 @@ LL | let z: &Vec<_> = y.clone();
help: try dereferencing it
|
LL | let z: &Vec<_> = &(*y).clone();
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
help: or try being explicit if you are sure, that you want to clone a reference
|
LL | let z: &Vec<_> = <&std::vec::Vec<i32>>::clone(y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: using `clone` on type `many_derefs::E` which implements the `Copy` trait
--> $DIR/unnecessary_clone.rs:84:20
@@ -75,11 +75,11 @@ LL | let _ = &mut encoded.clone();
help: try dereferencing it
|
LL | let _ = &mut &(*encoded).clone();
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
help: or try being explicit if you are sure, that you want to clone a reference
|
LL | let _ = &mut <&[u8]>::clone(encoded);
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~
error: using `clone` on a double-reference; this will copy the reference of type `&[u8]` instead of cloning the inner type
--> $DIR/unnecessary_clone.rs:90:18
@@ -90,11 +90,11 @@ LL | let _ = &encoded.clone();
help: try dereferencing it
|
LL | let _ = &&(*encoded).clone();
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
help: or try being explicit if you are sure, that you want to clone a reference
|
LL | let _ = &<&[u8]>::clone(encoded);
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~
error: using `.clone()` on a ref-counted pointer
--> $DIR/unnecessary_clone.rs:108:14
diff --git a/src/tools/clippy/tests/ui/unnecessary_wraps.stderr b/src/tools/clippy/tests/ui/unnecessary_wraps.stderr
index 0e570397e2a..8e31db39502 100644
--- a/src/tools/clippy/tests/ui/unnecessary_wraps.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_wraps.stderr
@@ -14,14 +14,14 @@ LL | | }
help: remove `Option` from the return type...
|
LL | fn func1(a: bool, b: bool) -> i32 {
- | ^^^
+ | ~~~
help: ...and then change returning expressions
|
-LL | return 42;
+LL ~ return 42;
LL | }
LL | if a {
LL | Some(-1);
-LL | 2
+LL ~ 2
LL | } else {
...
@@ -39,12 +39,12 @@ LL | | }
help: remove `Option` from the return type...
|
LL | fn func2(a: bool, b: bool) -> i32 {
- | ^^^
+ | ~~~
help: ...and then change returning expressions
|
-LL | return 10;
+LL ~ return 10;
LL | }
-LL | if a { 20 } else { 30 }
+LL ~ if a { 20 } else { 30 }
|
error: this function's return value is unnecessarily wrapped by `Option`
@@ -58,7 +58,7 @@ LL | | }
help: remove `Option` from the return type...
|
LL | fn func5() -> i32 {
- | ^^^
+ | ~~~
help: ...and then change returning expressions
|
LL | 1
@@ -75,7 +75,7 @@ LL | | }
help: remove `Result` from the return type...
|
LL | fn func7() -> i32 {
- | ^^^
+ | ~~~
help: ...and then change returning expressions
|
LL | 1
@@ -92,7 +92,7 @@ LL | | }
help: remove `Option` from the return type...
|
LL | fn func12() -> i32 {
- | ^^^
+ | ~~~
help: ...and then change returning expressions
|
LL | 1
@@ -113,14 +113,14 @@ LL | | }
help: remove the return type...
|
LL | fn issue_6640_1(a: bool, b: bool) -> Option<()> {
- | ^^^^^^^^^^
+ | ~~~~~~~~~~
help: ...and then remove returned values
|
-LL | return ;
+LL ~ return ;
LL | }
LL | if a {
LL | Some(());
-LL |
+LL ~
LL | } else {
...
@@ -139,15 +139,15 @@ LL | | }
help: remove the return type...
|
LL | fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
help: ...and then remove returned values
|
-LL | return ;
+LL ~ return ;
LL | }
LL | if a {
-LL |
+LL ~
LL | } else {
-LL | return ;
+LL ~ return ;
|
error: aborting due to 7 previous errors
diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns.stderr b/src/tools/clippy/tests/ui/unnested_or_patterns.stderr
index f7cb513c15c..de424c3fdb8 100644
--- a/src/tools/clippy/tests/ui/unnested_or_patterns.stderr
+++ b/src/tools/clippy/tests/ui/unnested_or_patterns.stderr
@@ -8,7 +8,7 @@ LL | if let box 0 | box 2 = Box::new(0) {}
help: nest the patterns
|
LL | if let box (0 | 2) = Box::new(0) {}
- | ^^^^^^^^^^^
+ | ~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:10:12
@@ -19,7 +19,7 @@ LL | if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {}
help: nest the patterns
|
LL | if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:12:12
@@ -30,7 +30,7 @@ LL | if let &0 | C0 | &2 = &0 {}
help: nest the patterns
|
LL | if let &(0 | 2) | C0 = &0 {}
- | ^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:13:12
@@ -41,7 +41,7 @@ LL | if let &mut 0 | &mut 2 = &mut 0 {}
help: nest the patterns
|
LL | if let &mut (0 | 2) = &mut 0 {}
- | ^^^^^^^^^^^^
+ | ~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:14:12
@@ -52,7 +52,7 @@ LL | if let x @ 0 | x @ 2 = 0 {}
help: nest the patterns
|
LL | if let x @ (0 | 2) = 0 {}
- | ^^^^^^^^^^^
+ | ~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:15:12
@@ -63,7 +63,7 @@ LL | if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}
help: nest the patterns
|
LL | if let (0, 1 | 2 | 3) = (0, 0) {}
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:16:12
@@ -74,7 +74,7 @@ LL | if let (1, 0) | (2, 0) | (3, 0) = (0, 0) {}
help: nest the patterns
|
LL | if let (1 | 2 | 3, 0) = (0, 0) {}
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:17:12
@@ -85,7 +85,7 @@ LL | if let (x, ..) | (x, 1) | (x, 2) = (0, 1) {}
help: nest the patterns
|
LL | if let (x, ..) | (x, 1 | 2) = (0, 1) {}
- | ^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:18:12
@@ -96,7 +96,7 @@ LL | if let [0] | [1] = [0] {}
help: nest the patterns
|
LL | if let [0 | 1] = [0] {}
- | ^^^^^^^
+ | ~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:19:12
@@ -107,7 +107,7 @@ LL | if let [x, 0] | [x, 1] = [0, 1] {}
help: nest the patterns
|
LL | if let [x, 0 | 1] = [0, 1] {}
- | ^^^^^^^^^^
+ | ~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:20:12
@@ -118,7 +118,7 @@ LL | if let [x, 0] | [x, 1] | [x, 2] = [0, 1] {}
help: nest the patterns
|
LL | if let [x, 0 | 1 | 2] = [0, 1] {}
- | ^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:21:12
@@ -129,7 +129,7 @@ LL | if let [x, ..] | [x, 1] | [x, 2] = [0, 1] {}
help: nest the patterns
|
LL | if let [x, ..] | [x, 1 | 2] = [0, 1] {}
- | ^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:23:12
@@ -140,7 +140,7 @@ LL | if let TS(0, x) | TS(1, x) = TS(0, 0) {}
help: nest the patterns
|
LL | if let TS(0 | 1, x) = TS(0, 0) {}
- | ^^^^^^^^^^^^
+ | ~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:24:12
@@ -151,7 +151,7 @@ LL | if let TS(1, 0) | TS(2, 0) | TS(3, 0) = TS(0, 0) {}
help: nest the patterns
|
LL | if let TS(1 | 2 | 3, 0) = TS(0, 0) {}
- | ^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:25:12
@@ -162,7 +162,7 @@ LL | if let TS(x, ..) | TS(x, 1) | TS(x, 2) = TS(0, 0) {}
help: nest the patterns
|
LL | if let TS(x, ..) | TS(x, 1 | 2) = TS(0, 0) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns.rs:30:12
@@ -173,7 +173,7 @@ LL | if let S { x: 0, y } | S { y, x: 1 } = (S { x: 0, y: 1 }) {}
help: nest the patterns
|
LL | if let S { x: 0 | 1, y } = (S { x: 0, y: 1 }) {}
- | ^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~
error: aborting due to 16 previous errors
diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr b/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr
index 9042c9c00b1..41e8d3fc709 100644
--- a/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr
+++ b/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr
@@ -8,7 +8,7 @@ LL | if let Some(Some(0)) | Some(Some(1)) = None {}
help: nest the patterns
|
LL | if let Some(Some(0 | 1)) = None {}
- | ^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:10:12
@@ -19,7 +19,7 @@ LL | if let Some(Some(0)) | Some(Some(1) | Some(2)) = None {}
help: nest the patterns
|
LL | if let Some(Some(0 | 1 | 2)) = None {}
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:11:12
@@ -30,7 +30,7 @@ LL | if let Some(Some(0 | 1) | Some(2)) | Some(Some(3) | Some(4)) = None {}
help: nest the patterns
|
LL | if let Some(Some(0 | 1 | 2 | 3 | 4)) = None {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:12:12
@@ -41,7 +41,7 @@ LL | if let Some(Some(0) | Some(1 | 2)) = None {}
help: nest the patterns
|
LL | if let Some(Some(0 | 1 | 2)) = None {}
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:13:12
@@ -52,7 +52,7 @@ LL | if let ((0,),) | ((1,) | (2,),) = ((0,),) {}
help: nest the patterns
|
LL | if let ((0 | 1 | 2,),) = ((0,),) {}
- | ^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:14:12
@@ -63,7 +63,7 @@ LL | if let 0 | (1 | 2) = 0 {}
help: nest the patterns
|
LL | if let 0 | 1 | 2 = 0 {}
- | ^^^^^^^^^
+ | ~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:15:12
@@ -74,7 +74,7 @@ LL | if let box (0 | 1) | (box 2 | box (3 | 4)) = Box::new(0) {}
help: nest the patterns
|
LL | if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~~~~~
error: unnested or-patterns
--> $DIR/unnested_or_patterns2.rs:16:12
@@ -85,7 +85,7 @@ LL | if let box box 0 | box (box 2 | box 4) = Box::new(Box::new(0)) {}
help: nest the patterns
|
LL | if let box box (0 | 2 | 4) = Box::new(Box::new(0)) {}
- | ^^^^^^^^^^^^^^^^^^^
+ | ~~~~~~~~~~~~~~~~~~~
error: aborting due to 8 previous errors
diff --git a/src/tools/clippy/tests/ui/write_literal.stderr b/src/tools/clippy/tests/ui/write_literal.stderr
index 507a78e8280..e0297c00231 100644
--- a/src/tools/clippy/tests/ui/write_literal.stderr
+++ b/src/tools/clippy/tests/ui/write_literal.stderr
@@ -7,8 +7,9 @@ LL | write!(&mut v, "Hello {}", "world");
= note: `-D clippy::write-literal` implied by `-D warnings`
help: try this
|
-LL | write!(&mut v, "Hello world");
- | ^^^^^--
+LL - write!(&mut v, "Hello {}", "world");
+LL + write!(&mut v, "Hello world");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:31:44
@@ -18,8 +19,9 @@ LL | writeln!(&mut v, "Hello {} {}", world, "world");
|
help: try this
|
-LL | writeln!(&mut v, "Hello {} world", world);
- | ^^^^^ --
+LL - writeln!(&mut v, "Hello {} {}", world, "world");
+LL + writeln!(&mut v, "Hello {} world", world);
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:32:34
@@ -29,8 +31,9 @@ LL | writeln!(&mut v, "Hello {}", "world");
|
help: try this
|
-LL | writeln!(&mut v, "Hello world");
- | ^^^^^--
+LL - writeln!(&mut v, "Hello {}", "world");
+LL + writeln!(&mut v, "Hello world");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:37:33
@@ -40,8 +43,9 @@ LL | writeln!(&mut v, "{0} {1}", "hello", "world");
|
help: try this
|
-LL | writeln!(&mut v, "hello {1}", "world");
- | ^^^^^ --
+LL - writeln!(&mut v, "{0} {1}", "hello", "world");
+LL + writeln!(&mut v, "hello {1}", "world");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:37:42
@@ -51,8 +55,9 @@ LL | writeln!(&mut v, "{0} {1}", "hello", "world");
|
help: try this
|
-LL | writeln!(&mut v, "{0} world", "hello");
- | ^^^^^ --
+LL - writeln!(&mut v, "{0} {1}", "hello", "world");
+LL + writeln!(&mut v, "{0} world", "hello");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:38:33
@@ -62,8 +67,9 @@ LL | writeln!(&mut v, "{1} {0}", "hello", "world");
|
help: try this
|
-LL | writeln!(&mut v, "{1} hello", "world");
- | ^^^^^--
+LL - writeln!(&mut v, "{1} {0}", "hello", "world");
+LL + writeln!(&mut v, "{1} hello", "world");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:38:42
@@ -73,8 +79,9 @@ LL | writeln!(&mut v, "{1} {0}", "hello", "world");
|
help: try this
|
-LL | writeln!(&mut v, "world {0}", "hello");
- | ^^^^^ --
+LL - writeln!(&mut v, "{1} {0}", "hello", "world");
+LL + writeln!(&mut v, "world {0}", "hello");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:41:37
@@ -84,8 +91,9 @@ LL | writeln!(&mut v, "{foo} {bar}", foo = "hello", bar = "world");
|
help: try this
|
-LL | writeln!(&mut v, "hello {bar}", bar = "world");
- | ^^^^^ --
+LL - writeln!(&mut v, "{foo} {bar}", foo = "hello", bar = "world");
+LL + writeln!(&mut v, "hello {bar}", bar = "world");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:41:52
@@ -95,8 +103,9 @@ LL | writeln!(&mut v, "{foo} {bar}", foo = "hello", bar = "world");
|
help: try this
|
-LL | writeln!(&mut v, "{foo} world", foo = "hello");
- | ^^^^^ --
+LL - writeln!(&mut v, "{foo} {bar}", foo = "hello", bar = "world");
+LL + writeln!(&mut v, "{foo} world", foo = "hello");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:42:37
@@ -106,8 +115,9 @@ LL | writeln!(&mut v, "{bar} {foo}", foo = "hello", bar = "world");
|
help: try this
|
-LL | writeln!(&mut v, "{bar} hello", bar = "world");
- | ^^^^^--
+LL - writeln!(&mut v, "{bar} {foo}", foo = "hello", bar = "world");
+LL + writeln!(&mut v, "{bar} hello", bar = "world");
+ |
error: literal with an empty format string
--> $DIR/write_literal.rs:42:52
@@ -117,8 +127,9 @@ LL | writeln!(&mut v, "{bar} {foo}", foo = "hello", bar = "world");
|
help: try this
|
-LL | writeln!(&mut v, "world {foo}", foo = "hello");
- | ^^^^^ --
+LL - writeln!(&mut v, "{bar} {foo}", foo = "hello", bar = "world");
+LL + writeln!(&mut v, "world {foo}", foo = "hello");
+ |
error: aborting due to 11 previous errors
diff --git a/src/tools/clippy/tests/ui/write_literal_2.stderr b/src/tools/clippy/tests/ui/write_literal_2.stderr
index 0aa1b55e58c..73c6b885813 100644
--- a/src/tools/clippy/tests/ui/write_literal_2.stderr
+++ b/src/tools/clippy/tests/ui/write_literal_2.stderr
@@ -7,8 +7,9 @@ LL | writeln!(&mut v, "{}", "{hello}");
= note: `-D clippy::write-literal` implied by `-D warnings`
help: try this
|
-LL | writeln!(&mut v, "{{hello}}");
- | ^^^^^^^^^--
+LL - writeln!(&mut v, "{}", "{hello}");
+LL + writeln!(&mut v, "{{hello}}");
+ |
error: literal with an empty format string
--> $DIR/write_literal_2.rs:10:29
@@ -18,8 +19,9 @@ LL | writeln!(&mut v, r"{}", r"{hello}");
|
help: try this
|
-LL | writeln!(&mut v, r"{{hello}}");
- | ^^^^^^^^^--
+LL - writeln!(&mut v, r"{}", r"{hello}");
+LL + writeln!(&mut v, r"{{hello}}");
+ |
error: literal with an empty format string
--> $DIR/write_literal_2.rs:11:28
@@ -29,8 +31,9 @@ LL | writeln!(&mut v, "{}", '/'');
|
help: try this
|
-LL | writeln!(&mut v, "'");
- | ^--
+LL - writeln!(&mut v, "{}", '/'');
+LL + writeln!(&mut v, "'");
+ |
error: literal with an empty format string
--> $DIR/write_literal_2.rs:12:28
@@ -40,8 +43,9 @@ LL | writeln!(&mut v, "{}", '"');
|
help: try this
|
-LL | writeln!(&mut v, "/"");
- | ^^--
+LL - writeln!(&mut v, "{}", '"');
+LL + writeln!(&mut v, "/"");
+ |
error: literal with an empty format string
--> $DIR/write_literal_2.rs:14:29
@@ -51,8 +55,9 @@ LL | writeln!(&mut v, r"{}", '/'');
|
help: try this
|
-LL | writeln!(&mut v, r"'");
- | ^--
+LL - writeln!(&mut v, r"{}", '/'');
+LL + writeln!(&mut v, r"'");
+ |
error: literal with an empty format string
--> $DIR/write_literal_2.rs:18:9
@@ -63,8 +68,8 @@ LL | | world!"
|
help: try this
|
-LL | "some hello /
-LL | world!"
+LL ~ "some hello /
+LL ~ world!"
|
error: literal with an empty format string
@@ -75,8 +80,8 @@ LL | "1", "2", "3",
|
help: try this
|
-LL | "some 1/
-LL | {} / {}", "2", "3",
+LL ~ "some 1/
+LL ~ {} / {}", "2", "3",
|
error: literal with an empty format string
@@ -87,8 +92,8 @@ LL | "1", "2", "3",
|
help: try this
|
-LL | 2 / {}",
-LL | "1", "3",
+LL ~ 2 / {}",
+LL ~ "1", "3",
|
error: literal with an empty format string
@@ -99,8 +104,8 @@ LL | "1", "2", "3",
|
help: try this
|
-LL | {} / 3",
-LL | "1", "2",
+LL ~ {} / 3",
+LL ~ "1", "2",
|
error: aborting due to 9 previous errors
diff --git a/src/tools/clippy/tests/ui/write_with_newline.stderr b/src/tools/clippy/tests/ui/write_with_newline.stderr
index cecc2ea9406..186459e50b6 100644
--- a/src/tools/clippy/tests/ui/write_with_newline.stderr
+++ b/src/tools/clippy/tests/ui/write_with_newline.stderr
@@ -7,8 +7,9 @@ LL | write!(&mut v, "Hello/n");
= note: `-D clippy::write-with-newline` implied by `-D warnings`
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "Hello");
- | ^^^^^^^ --
+LL - write!(&mut v, "Hello/n");
+LL + writeln!(&mut v, "Hello");
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:14:5
@@ -18,8 +19,9 @@ LL | write!(&mut v, "Hello {}/n", "world");
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "Hello {}", "world");
- | ^^^^^^^ --
+LL - write!(&mut v, "Hello {}/n", "world");
+LL + writeln!(&mut v, "Hello {}", "world");
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:15:5
@@ -29,8 +31,9 @@ LL | write!(&mut v, "Hello {} {}/n", "world", "#2");
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "Hello {} {}", "world", "#2");
- | ^^^^^^^ --
+LL - write!(&mut v, "Hello {} {}/n", "world", "#2");
+LL + writeln!(&mut v, "Hello {} {}", "world", "#2");
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:16:5
@@ -40,8 +43,9 @@ LL | write!(&mut v, "{}/n", 1265);
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "{}", 1265);
- | ^^^^^^^ --
+LL - write!(&mut v, "{}/n", 1265);
+LL + writeln!(&mut v, "{}", 1265);
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:17:5
@@ -51,8 +55,9 @@ LL | write!(&mut v, "/n");
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v);
- | ^^^^^^^ --
+LL - write!(&mut v, "/n");
+LL + writeln!(&mut v);
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:36:5
@@ -62,8 +67,9 @@ LL | write!(&mut v, "//n"); // should fail
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "/"); // should fail
- | ^^^^^^^ --
+LL - write!(&mut v, "//n"); // should fail
+LL + writeln!(&mut v, "/"); // should fail
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:43:5
@@ -77,9 +83,9 @@ LL | | );
|
help: use `writeln!()` instead
|
-LL | writeln!(
+LL ~ writeln!(
LL | &mut v,
-LL | ""
+LL ~ ""
|
error: using `write!()` with a format string that ends in a single newline
@@ -94,9 +100,9 @@ LL | | );
|
help: use `writeln!()` instead
|
-LL | writeln!(
+LL ~ writeln!(
LL | &mut v,
-LL | r""
+LL ~ r""
|
error: using `write!()` with a format string that ends in a single newline
@@ -107,8 +113,9 @@ LL | write!(&mut v, "/r/n"); //~ ERROR
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "/r"); //~ ERROR
- | ^^^^^^^ --
+LL - write!(&mut v, "/r/n"); //~ ERROR
+LL + writeln!(&mut v, "/r"); //~ ERROR
+ |
error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:58:5
@@ -118,8 +125,9 @@ LL | write!(&mut v, "foo/rbar/n");
|
help: use `writeln!()` instead
|
-LL | writeln!(&mut v, "foo/rbar");
- | ^^^^^^^ --
+LL - write!(&mut v, "foo/rbar/n");
+LL + writeln!(&mut v, "foo/rbar");
+ |
error: aborting due to 10 previous errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment