Skip to content

Commit

Permalink
update clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Aug 11, 2021
1 parent 99f2977 commit 657caa5
Show file tree
Hide file tree
Showing 71 changed files with 961 additions and 906 deletions.
36 changes: 18 additions & 18 deletions src/tools/clippy/tests/ui/assign_ops2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/tools/clippy/tests/ui/async_yields_async.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
...
Expand All @@ -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

8 changes: 4 additions & 4 deletions src/tools/clippy/tests/ui/blocks_in_if_conditions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 657caa5

Please sign in to comment.