@@ -42,7 +42,7 @@ use syntax::source_map::Spanned;
4242use syntax:: edition:: Edition ;
4343use syntax:: feature_gate:: { self , AttributeGate , AttributeType } ;
4444use syntax:: feature_gate:: { Stability , deprecated_attributes} ;
45- use syntax_pos:: { BytePos , Span , SyntaxContext } ;
45+ use syntax_pos:: { BytePos , Span } ;
4646use syntax:: symbol:: { Symbol , kw, sym} ;
4747use syntax:: errors:: { Applicability , DiagnosticBuilder } ;
4848use syntax:: print:: pprust:: expr_to_string;
@@ -78,7 +78,7 @@ impl EarlyLintPass for WhileTrue {
7878 if let ast:: ExprKind :: While ( cond, ..) = & e. node {
7979 if let ast:: ExprKind :: Lit ( ref lit) = pierce_parens ( cond) . node {
8080 if let ast:: LitKind :: Bool ( true ) = lit. node {
81- if lit. span . ctxt ( ) == SyntaxContext :: empty ( ) {
81+ if ! lit. span . from_expansion ( ) {
8282 let msg = "denote infinite loops with `loop { ... }`" ;
8383 let condition_span = cx. sess . source_map ( ) . def_span ( e. span ) ;
8484 cx. struct_span_lint ( WHILE_TRUE , condition_span, msg)
@@ -167,7 +167,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
167167 if fieldpat. is_shorthand {
168168 continue ;
169169 }
170- if fieldpat. span . ctxt ( ) . outer_expn_info ( ) . is_some ( ) {
170+ if fieldpat. span . from_expansion ( ) {
171171 // Don't lint if this is a macro expansion: macro authors
172172 // shouldn't have to worry about this kind of style issue
173173 // (Issue #49588)
@@ -1012,7 +1012,7 @@ impl UnreachablePub {
10121012 let mut applicability = Applicability :: MachineApplicable ;
10131013 match vis. node {
10141014 hir:: VisibilityKind :: Public if !cx. access_levels . is_reachable ( id) => {
1015- if span. ctxt ( ) . outer_expn_info ( ) . is_some ( ) {
1015+ if span. from_expansion ( ) {
10161016 applicability = Applicability :: MaybeIncorrect ;
10171017 }
10181018 let def_span = cx. tcx . sess . source_map ( ) . def_span ( span) ;
0 commit comments