@@ -27,7 +27,7 @@ use std::io;
27
27
use std:: io:: prelude:: * ;
28
28
29
29
use syntax:: codemap:: CodeMap ;
30
- use syntax:: parse:: lexer:: { self , Reader , TokenAndSpan } ;
30
+ use syntax:: parse:: lexer:: { self , TokenAndSpan } ;
31
31
use syntax:: parse:: token;
32
32
use syntax:: parse;
33
33
use syntax_pos:: Span ;
@@ -42,8 +42,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>, id: Option<&str>
42
42
let mut out = Vec :: new ( ) ;
43
43
write_header ( class, id, & mut out) . unwrap ( ) ;
44
44
45
- let mut classifier = Classifier :: new ( lexer:: StringReader :: new ( & sess. span_diagnostic , fm) ,
46
- sess. codemap ( ) ) ;
45
+ let mut classifier = Classifier :: new ( lexer:: StringReader :: new ( & sess, fm) , sess. codemap ( ) ) ;
47
46
if let Err ( _) = classifier. write_source ( & mut out) {
48
47
return format ! ( "<pre>{}</pre>" , src) ;
49
48
}
@@ -63,8 +62,7 @@ pub fn render_inner_with_highlighting(src: &str) -> io::Result<String> {
63
62
let fm = sess. codemap ( ) . new_filemap ( "<stdin>" . to_string ( ) , None , src. to_string ( ) ) ;
64
63
65
64
let mut out = Vec :: new ( ) ;
66
- let mut classifier = Classifier :: new ( lexer:: StringReader :: new ( & sess. span_diagnostic , fm) ,
67
- sess. codemap ( ) ) ;
65
+ let mut classifier = Classifier :: new ( lexer:: StringReader :: new ( & sess, fm) , sess. codemap ( ) ) ;
68
66
classifier. write_source ( & mut out) ?;
69
67
70
68
Ok ( String :: from_utf8_lossy ( & out) . into_owned ( ) )
@@ -185,10 +183,10 @@ impl<'a> Classifier<'a> {
185
183
Ok ( tas) => tas,
186
184
Err ( _) => {
187
185
self . lexer . emit_fatal_errors ( ) ;
188
- self . lexer . span_diagnostic . struct_warn ( "Backing out of syntax highlighting" )
189
- . note ( "You probably did not intend to render this \
190
- as a rust code-block")
191
- . emit ( ) ;
186
+ self . lexer . sess . span_diagnostic
187
+ . struct_warn ( "Backing out of syntax highlighting" )
188
+ . note ( "You probably did not intend to render this as a rust code-block")
189
+ . emit ( ) ;
192
190
return Err ( io:: Error :: new ( io:: ErrorKind :: Other , "" ) ) ;
193
191
}
194
192
} ;
0 commit comments