@@ -471,44 +471,44 @@ impl<'a> Deref for DiagnosticWrapper<'a> {
471
471
}
472
472
}
473
473
474
+ impl < ' a > DiagnosticWrapper < ' a > {
475
+ fn wiki_link ( & mut self , lint : & ' static Lint ) {
476
+ self . help ( & format ! ( "for further information visit https://github.com/Manishearth/rust-clippy/wiki#{}" ,
477
+ lint. name_lower( ) ) ) ;
478
+ }
479
+ }
480
+
474
481
pub fn span_lint < ' a , T : LintContext > ( cx : & ' a T , lint : & ' static Lint , sp : Span , msg : & str ) -> DiagnosticWrapper < ' a > {
475
- let mut db = cx. struct_span_lint ( lint, sp, msg) ;
482
+ let mut db = DiagnosticWrapper ( cx. struct_span_lint ( lint, sp, msg) ) ;
476
483
if cx. current_level ( lint) != Level :: Allow {
477
- db. fileline_help ( sp,
478
- & format ! ( "for further information visit https://github.com/Manishearth/rust-clippy/wiki#{}" ,
479
- lint. name_lower( ) ) ) ;
484
+ db. wiki_link ( lint) ;
480
485
}
481
- DiagnosticWrapper ( db )
486
+ db
482
487
}
483
488
484
489
pub fn span_help_and_lint < ' a , T : LintContext > ( cx : & ' a T , lint : & ' static Lint , span : Span , msg : & str , help : & str )
485
490
-> DiagnosticWrapper < ' a > {
486
- let mut db = cx. struct_span_lint ( lint, span, msg) ;
491
+ let mut db = DiagnosticWrapper ( cx. struct_span_lint ( lint, span, msg) ) ;
487
492
if cx. current_level ( lint) != Level :: Allow {
488
- db. fileline_help ( span,
489
- & format ! ( "{}\n for further information visit \
490
- https://github.com/Manishearth/rust-clippy/wiki#{}",
491
- help,
492
- lint. name_lower( ) ) ) ;
493
+ db. help ( help) ;
494
+ db. wiki_link ( lint) ;
493
495
}
494
- DiagnosticWrapper ( db )
496
+ db
495
497
}
496
498
497
499
pub fn span_note_and_lint < ' a , T : LintContext > ( cx : & ' a T , lint : & ' static Lint , span : Span , msg : & str , note_span : Span ,
498
500
note : & str )
499
501
-> DiagnosticWrapper < ' a > {
500
- let mut db = cx. struct_span_lint ( lint, span, msg) ;
502
+ let mut db = DiagnosticWrapper ( cx. struct_span_lint ( lint, span, msg) ) ;
501
503
if cx. current_level ( lint) != Level :: Allow {
502
504
if note_span == span {
503
- db. fileline_note ( note_span , note) ;
505
+ db. note ( note) ;
504
506
} else {
505
507
db. span_note ( note_span, note) ;
506
508
}
507
- db. fileline_help ( span,
508
- & format ! ( "for further information visit https://github.com/Manishearth/rust-clippy/wiki#{}" ,
509
- lint. name_lower( ) ) ) ;
509
+ db. wiki_link ( lint) ;
510
510
}
511
- DiagnosticWrapper ( db )
511
+ db
512
512
}
513
513
514
514
pub fn span_lint_and_then < ' a , T : LintContext , F > ( cx : & ' a T , lint : & ' static Lint , sp : Span , msg : & str , f : F )
@@ -518,9 +518,7 @@ pub fn span_lint_and_then<'a, T: LintContext, F>(cx: &'a T, lint: &'static Lint,
518
518
let mut db = DiagnosticWrapper ( cx. struct_span_lint ( lint, sp, msg) ) ;
519
519
if cx. current_level ( lint) != Level :: Allow {
520
520
f ( & mut db) ;
521
- db. fileline_help ( sp,
522
- & format ! ( "for further information visit https://github.com/Manishearth/rust-clippy/wiki#{}" ,
523
- lint. name_lower( ) ) ) ;
521
+ db. wiki_link ( lint) ;
524
522
}
525
523
db
526
524
}
0 commit comments