File tree 2 files changed +6
-2
lines changed
compiler/rustc_parse/src/parser
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -611,10 +611,12 @@ impl<'a> Parser<'a> {
611
611
let mut err = self . struct_span_err ( self . token . span , msg_exp) ;
612
612
613
613
// Look for usages of '=>' where '>=' was probably intended
614
- if self . token == token:: FatArrow {
614
+ if self . token == token:: FatArrow
615
+ && expected. iter ( ) . any ( |tok| matches ! ( tok, TokenType :: Token ( TokenKind :: Le ) ) )
616
+ {
615
617
err. span_suggestion (
616
618
self . token . span ,
617
- "you probably meant to write a \" greater than or equal to\" comparison" ,
619
+ "you might have meant to write a \" greater than or equal to\" comparison" ,
618
620
">=" ,
619
621
Applicability :: Unspecified ,
620
622
) ;
Original file line number Diff line number Diff line change
1
+ // run-rustfix
1
2
// Check that we try to correct `=>` to `>=` in conditions.
3
+ #![ allow( unused) ]
2
4
3
5
fn main ( ) {
4
6
let a = 0 ;
You can’t perform that action at this time.
0 commit comments