@@ -13,7 +13,6 @@ use std::iter::Peekable;
13
13
use rustc_lexer:: { LiteralKind , TokenKind } ;
14
14
use rustc_span:: edition:: Edition ;
15
15
use rustc_span:: symbol:: Symbol ;
16
- use rustc_span:: with_default_session_globals;
17
16
18
17
use super :: format:: Buffer ;
19
18
@@ -238,28 +237,26 @@ impl<'a> Classifier<'a> {
238
237
/// possibly giving it an HTML span with a class specifying what flavor of
239
238
/// token is used.
240
239
fn highlight ( mut self , sink : & mut dyn FnMut ( Highlight < ' a > ) ) {
241
- with_default_session_globals ( || {
242
- loop {
243
- if self
244
- . tokens
245
- . peek ( )
246
- . map ( |t| matches ! ( t. 0 , TokenKind :: Colon | TokenKind :: Ident ) )
247
- . unwrap_or ( false )
248
- {
249
- let tokens = self . get_full_ident_path ( ) ;
250
- for ( token, start, end) in tokens {
251
- let text = & self . src [ start..end] ;
252
- self . advance ( token, text, sink) ;
253
- self . byte_pos += text. len ( ) as u32 ;
254
- }
255
- }
256
- if let Some ( ( token, text) ) = self . next ( ) {
240
+ loop {
241
+ if self
242
+ . tokens
243
+ . peek ( )
244
+ . map ( |t| matches ! ( t. 0 , TokenKind :: Colon | TokenKind :: Ident ) )
245
+ . unwrap_or ( false )
246
+ {
247
+ let tokens = self . get_full_ident_path ( ) ;
248
+ for ( token, start, end) in tokens {
249
+ let text = & self . src [ start..end] ;
257
250
self . advance ( token, text, sink) ;
258
- } else {
259
- break ;
251
+ self . byte_pos += text. len ( ) as u32 ;
260
252
}
261
253
}
262
- } )
254
+ if let Some ( ( token, text) ) = self . next ( ) {
255
+ self . advance ( token, text, sink) ;
256
+ } else {
257
+ break ;
258
+ }
259
+ }
263
260
}
264
261
265
262
/// Single step of highlighting. This will classify `token`, but maybe also
0 commit comments