File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 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> {
611611 let mut err = self . struct_span_err ( self . token . span , msg_exp) ;
612612
613613 // 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+ {
615617 err. span_suggestion (
616618 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" ,
618620 ">=" ,
619621 Applicability :: Unspecified ,
620622 ) ;
Original file line number Diff line number Diff line change 1+ // run-rustfix
12// Check that we try to correct `=>` to `>=` in conditions.
3+ #![ allow( unused) ]
24
35fn main ( ) {
46 let a = 0 ;
You can’t perform that action at this time.
0 commit comments