@@ -237,7 +237,7 @@ impl EarlyLintPass for Write {
237
237
fn check_mac ( & mut self , cx : & EarlyContext < ' _ > , mac : & MacCall ) {
238
238
if mac. path == sym ! ( println) {
239
239
span_lint ( cx, PRINT_STDOUT , mac. span ( ) , "use of `println!`" ) ;
240
- if let ( Some ( fmt_str) , _) = self . check_tts ( cx, & mac. args . inner_tokens ( ) , false ) {
240
+ if let ( Some ( fmt_str) , _) = self . check_tts ( cx, mac. args . inner_tokens ( ) , false ) {
241
241
if fmt_str. symbol == Symbol :: intern ( "" ) {
242
242
span_lint_and_sugg (
243
243
cx,
@@ -252,7 +252,7 @@ impl EarlyLintPass for Write {
252
252
}
253
253
} else if mac. path == sym ! ( print) {
254
254
span_lint ( cx, PRINT_STDOUT , mac. span ( ) , "use of `print!`" ) ;
255
- if let ( Some ( fmt_str) , _) = self . check_tts ( cx, & mac. args . inner_tokens ( ) , false ) {
255
+ if let ( Some ( fmt_str) , _) = self . check_tts ( cx, mac. args . inner_tokens ( ) , false ) {
256
256
if check_newlines ( & fmt_str) {
257
257
span_lint_and_then (
258
258
cx,
@@ -273,7 +273,7 @@ impl EarlyLintPass for Write {
273
273
}
274
274
}
275
275
} else if mac. path == sym ! ( write) {
276
- if let ( Some ( fmt_str) , _) = self . check_tts ( cx, & mac. args . inner_tokens ( ) , true ) {
276
+ if let ( Some ( fmt_str) , _) = self . check_tts ( cx, mac. args . inner_tokens ( ) , true ) {
277
277
if check_newlines ( & fmt_str) {
278
278
span_lint_and_then (
279
279
cx,
@@ -294,7 +294,7 @@ impl EarlyLintPass for Write {
294
294
}
295
295
}
296
296
} else if mac. path == sym ! ( writeln) {
297
- if let ( Some ( fmt_str) , expr) = self . check_tts ( cx, & mac. args . inner_tokens ( ) , true ) {
297
+ if let ( Some ( fmt_str) , expr) = self . check_tts ( cx, mac. args . inner_tokens ( ) , true ) {
298
298
if fmt_str. symbol == Symbol :: intern ( "" ) {
299
299
let mut applicability = Applicability :: MachineApplicable ;
300
300
let suggestion = expr. map_or_else (
@@ -364,17 +364,11 @@ impl Write {
364
364
/// (Some("string to write: {}"), Some(buf))
365
365
/// ```
366
366
#[ allow( clippy:: too_many_lines) ]
367
- fn check_tts < ' a > (
368
- & self ,
369
- cx : & EarlyContext < ' a > ,
370
- tts : & TokenStream ,
371
- is_write : bool ,
372
- ) -> ( Option < StrLit > , Option < Expr > ) {
367
+ fn check_tts < ' a > ( & self , cx : & EarlyContext < ' a > , tts : TokenStream , is_write : bool ) -> ( Option < StrLit > , Option < Expr > ) {
373
368
use rustc_parse_format:: {
374
369
AlignUnknown , ArgumentImplicitlyIs , ArgumentIs , ArgumentNamed , CountImplied , FormatSpec , ParseMode , Parser ,
375
370
Piece ,
376
371
} ;
377
- let tts = tts. clone ( ) ;
378
372
379
373
let mut parser = parser:: Parser :: new ( & cx. sess . parse_sess , tts, false , None ) ;
380
374
let mut expr: Option < Expr > = None ;
0 commit comments