@@ -520,6 +520,7 @@ impl SpanData {
520520    pub  fn  with_hi ( & self ,  hi :  BytePos )  -> Span  { 
521521        Span :: new ( self . lo ,  hi,  self . ctxt ,  self . parent ) 
522522    } 
523+     /// Avoid if possible, `Span::map_ctxt` should be preferred. 
523524#[ inline]  
524525    fn  with_ctxt ( & self ,  ctxt :  SyntaxContext )  -> Span  { 
525526        Span :: new ( self . lo ,  self . hi ,  ctxt,  self . parent ) 
@@ -576,9 +577,8 @@ impl Span {
576577        self . data ( ) . with_hi ( hi) 
577578    } 
578579    #[ inline]  
579-     pub  fn  with_ctxt ( mut  self ,  ctxt :  SyntaxContext )  -> Span  { 
580-         self . update_ctxt ( |_| ctxt) ; 
581-         self 
580+     pub  fn  with_ctxt ( self ,  ctxt :  SyntaxContext )  -> Span  { 
581+         self . map_ctxt ( |_| ctxt) 
582582    } 
583583    #[ inline]  
584584    pub  fn  parent ( self )  -> Option < LocalDefId >  { 
@@ -1059,9 +1059,8 @@ impl Span {
10591059    } 
10601060
10611061    #[ inline]  
1062-     pub  fn  apply_mark ( mut  self ,  expn_id :  ExpnId ,  transparency :  Transparency )  -> Span  { 
1063-         self . update_ctxt ( |ctxt| ctxt. apply_mark ( expn_id,  transparency) ) ; 
1064-         self 
1062+     pub  fn  apply_mark ( self ,  expn_id :  ExpnId ,  transparency :  Transparency )  -> Span  { 
1063+         self . map_ctxt ( |ctxt| ctxt. apply_mark ( expn_id,  transparency) ) 
10651064    } 
10661065
10671066    #[ inline]  
@@ -1109,15 +1108,13 @@ impl Span {
11091108    } 
11101109
11111110    #[ inline]  
1112-     pub  fn  normalize_to_macros_2_0 ( mut  self )  -> Span  { 
1113-         self . update_ctxt ( |ctxt| ctxt. normalize_to_macros_2_0 ( ) ) ; 
1114-         self 
1111+     pub  fn  normalize_to_macros_2_0 ( self )  -> Span  { 
1112+         self . map_ctxt ( |ctxt| ctxt. normalize_to_macros_2_0 ( ) ) 
11151113    } 
11161114
11171115    #[ inline]  
1118-     pub  fn  normalize_to_macro_rules ( mut  self )  -> Span  { 
1119-         self . update_ctxt ( |ctxt| ctxt. normalize_to_macro_rules ( ) ) ; 
1120-         self 
1116+     pub  fn  normalize_to_macro_rules ( self )  -> Span  { 
1117+         self . map_ctxt ( |ctxt| ctxt. normalize_to_macro_rules ( ) ) 
11211118    } 
11221119} 
11231120
0 commit comments