@@ -114,7 +114,7 @@ pub fn in_macro(span: Span) -> bool {
114
114
// sources that the user has no control over.
115
115
// For some reason these attributes don't have any expansion info on them, so
116
116
// we have to check it this way until there is a better way.
117
- pub fn is_present_in_source < ' a , T : LintContext < ' a > > ( cx : & T , span : Span ) -> bool {
117
+ pub fn is_present_in_source < ' a , T : LintContext > ( cx : & T , span : Span ) -> bool {
118
118
if let Some ( snippet) = snippet_opt ( cx, span) {
119
119
if snippet. is_empty ( ) {
120
120
return false ;
@@ -455,7 +455,7 @@ pub fn contains_name(name: Name, expr: &Expr) -> bool {
455
455
/// ```rust,ignore
456
456
/// snippet(cx, expr.span, "..")
457
457
/// ```
458
- pub fn snippet < ' a , ' b , T : LintContext < ' b > > ( cx : & T , span : Span , default : & ' a str ) -> Cow < ' a , str > {
458
+ pub fn snippet < ' a , ' b , T : LintContext > ( cx : & T , span : Span , default : & ' a str ) -> Cow < ' a , str > {
459
459
snippet_opt ( cx, span) . map_or_else ( || Cow :: Borrowed ( default) , From :: from)
460
460
}
461
461
@@ -465,7 +465,7 @@ pub fn snippet<'a, 'b, T: LintContext<'b>>(cx: &T, span: Span, default: &'a str)
465
465
/// - If the span is inside a macro, change the applicability level to `MaybeIncorrect`.
466
466
/// - If the default value is used and the applicability level is `MachineApplicable`, change it to
467
467
/// `HasPlaceholders`
468
- pub fn snippet_with_applicability < ' a , ' b , T : LintContext < ' b > > (
468
+ pub fn snippet_with_applicability < ' a , ' b , T : LintContext > (
469
469
cx : & T ,
470
470
span : Span ,
471
471
default : & ' a str ,
@@ -487,12 +487,12 @@ pub fn snippet_with_applicability<'a, 'b, T: LintContext<'b>>(
487
487
488
488
/// Same as `snippet`, but should only be used when it's clear that the input span is
489
489
/// not a macro argument.
490
- pub fn snippet_with_macro_callsite < ' a , ' b , T : LintContext < ' b > > ( cx : & T , span : Span , default : & ' a str ) -> Cow < ' a , str > {
490
+ pub fn snippet_with_macro_callsite < ' a , ' b , T : LintContext > ( cx : & T , span : Span , default : & ' a str ) -> Cow < ' a , str > {
491
491
snippet ( cx, span. source_callsite ( ) , default)
492
492
}
493
493
494
494
/// Converts a span to a code snippet. Returns `None` if not available.
495
- pub fn snippet_opt < ' a , T : LintContext < ' a > > ( cx : & T , span : Span ) -> Option < String > {
495
+ pub fn snippet_opt < ' a , T : LintContext > ( cx : & T , span : Span ) -> Option < String > {
496
496
cx. sess ( ) . source_map ( ) . span_to_snippet ( span) . ok ( )
497
497
}
498
498
@@ -506,14 +506,14 @@ pub fn snippet_opt<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Option<String>
506
506
/// ```rust,ignore
507
507
/// snippet_block(cx, expr.span, "..")
508
508
/// ```
509
- pub fn snippet_block < ' a , ' b , T : LintContext < ' b > > ( cx : & T , span : Span , default : & ' a str ) -> Cow < ' a , str > {
509
+ pub fn snippet_block < ' a , ' b , T : LintContext > ( cx : & T , span : Span , default : & ' a str ) -> Cow < ' a , str > {
510
510
let snip = snippet ( cx, span, default) ;
511
511
trim_multiline ( snip, true )
512
512
}
513
513
514
514
/// Same as `snippet_block`, but adapts the applicability level by the rules of
515
515
/// `snippet_with_applicabiliy`.
516
- pub fn snippet_block_with_applicability < ' a , ' b , T : LintContext < ' b > > (
516
+ pub fn snippet_block_with_applicability < ' a , ' b , T : LintContext > (
517
517
cx : & T ,
518
518
span : Span ,
519
519
default : & ' a str ,
@@ -524,7 +524,7 @@ pub fn snippet_block_with_applicability<'a, 'b, T: LintContext<'b>>(
524
524
}
525
525
526
526
/// Returns a new Span that covers the full last line of the given Span
527
- pub fn last_line_of_span < ' a , T : LintContext < ' a > > ( cx : & T , span : Span ) -> Span {
527
+ pub fn last_line_of_span < ' a , T : LintContext > ( cx : & T , span : Span ) -> Span {
528
528
let source_map_and_line = cx. sess ( ) . source_map ( ) . lookup_line ( span. lo ( ) ) . unwrap ( ) ;
529
529
let line_no = source_map_and_line. line ;
530
530
let line_start = & source_map_and_line. sf . lines [ line_no] ;
@@ -533,7 +533,7 @@ pub fn last_line_of_span<'a, T: LintContext<'a>>(cx: &T, span: Span) -> Span {
533
533
534
534
/// Like `snippet_block`, but add braces if the expr is not an `ExprKind::Block`.
535
535
/// Also takes an `Option<String>` which can be put inside the braces.
536
- pub fn expr_block < ' a , ' b , T : LintContext < ' b > > (
536
+ pub fn expr_block < ' a , ' b , T : LintContext > (
537
537
cx : & T ,
538
538
expr : & Expr ,
539
539
option : Option < String > ,
0 commit comments