-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// run-rustfix | ||
// Check that we try to correct `=>` to `>=` in conditions. | ||
#![allow(unused)] | ||
|
||
fn main() { | ||
let a = 0; | ||
let b = 1; | ||
if a >= b {} //~ERROR | ||
} | ||
|
||
fn foo() { | ||
let a = 0; | ||
if a >= 1 {} //~ERROR | ||
} | ||
|
||
fn a() { | ||
let a = 0; | ||
if 1 >= a {} //~ERROR | ||
} | ||
|
||
fn bar() { | ||
let a = 0; | ||
let b = 1; | ||
if a >= b && a != b {} //~ERROR | ||
} | ||
|
||
fn qux() { | ||
let a = 0; | ||
let b = 1; | ||
if a != b && a >= b {} //~ERROR | ||
} | ||
|
||
fn baz() { | ||
let a = 0; | ||
let b = 1; | ||
let _ = a => b; //~ERROR | ||
} | ||
|
||
fn b() { | ||
let a = 0; | ||
let b = 1; | ||
match a => b { //~ERROR | ||
_ => todo!(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// run-rustfix | ||
// Check that we try to correct `=>` to `>=` in conditions. | ||
#![allow(unused)] | ||
|
||
fn main() { | ||
let a = 0; | ||
let b = 1; | ||
if a => b {} //~ERROR | ||
} | ||
|
||
fn foo() { | ||
let a = 0; | ||
if a => 1 {} //~ERROR | ||
} | ||
|
||
fn a() { | ||
let a = 0; | ||
if 1 => a {} //~ERROR | ||
} | ||
|
||
fn bar() { | ||
let a = 0; | ||
let b = 1; | ||
if a => b && a != b {} //~ERROR | ||
} | ||
|
||
fn qux() { | ||
let a = 0; | ||
let b = 1; | ||
if a != b && a => b {} //~ERROR | ||
} | ||
|
||
fn baz() { | ||
let a = 0; | ||
let b = 1; | ||
let _ = a => b; //~ERROR | ||
} | ||
|
||
fn b() { | ||
let a = 0; | ||
let b = 1; | ||
match a => b { //~ERROR | ||
_ => todo!(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
error: expected `{`, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:8:10 | ||
| | ||
LL | if a => b {} | ||
| ^^ expected `{` | ||
| | ||
help: you probably meant to write a "greater than or equal to" comparison | ||
| | ||
LL | if a >= b {} | ||
| ~~ | ||
|
||
error: expected `{`, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:13:10 | ||
| | ||
LL | if a => 1 {} | ||
| ^^ expected `{` | ||
| | ||
help: you probably meant to write a "greater than or equal to" comparison | ||
| | ||
LL | if a >= 1 {} | ||
| ~~ | ||
|
||
error: expected `{`, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:18:10 | ||
| | ||
LL | if 1 => a {} | ||
| ^^ expected `{` | ||
| | ||
help: you probably meant to write a "greater than or equal to" comparison | ||
| | ||
LL | if 1 >= a {} | ||
| ~~ | ||
|
||
error: expected `{`, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:24:10 | ||
| | ||
LL | if a => b && a != b {} | ||
| ^^ expected `{` | ||
| | ||
help: you probably meant to write a "greater than or equal to" comparison | ||
| | ||
LL | if a >= b && a != b {} | ||
| ~~ | ||
|
||
error: expected `{`, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:30:20 | ||
| | ||
LL | if a != b && a => b {} | ||
| ^^ expected `{` | ||
| | ||
help: you probably meant to write a "greater than or equal to" comparison | ||
| | ||
LL | if a != b && a >= b {} | ||
| ~~ | ||
|
||
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:36:15 | ||
| | ||
LL | let _ = a => b; | ||
| ^^ expected one of 8 possible tokens | ||
|
||
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `=>` | ||
--> $DIR/eq-gt-to-gt-eq.rs:42:13 | ||
| | ||
LL | match a => b { | ||
| ----- ^^ expected one of `!`, `.`, `::`, `?`, `{`, or an operator | ||
| | | ||
| while parsing this `match` expression | ||
|
||
error: aborting due to 7 previous errors | ||
|