@@ -648,10 +648,10 @@ impl EarlyLintPass for AnonymousParameters {
648648 cx. struct_span_lint ( ANONYMOUS_PARAMETERS , arg. pat . span , |lint| {
649649 let ty_snip = cx. sess . source_map ( ) . span_to_snippet ( arg. ty . span ) ;
650650
651- let ( ty_snip, appl) = if let Ok ( snip) = ty_snip {
652- ( snip, Applicability :: MachineApplicable )
651+ let ( ty_snip, appl) = if let Ok ( ref snip) = ty_snip {
652+ ( snip. as_str ( ) , Applicability :: MachineApplicable )
653653 } else {
654- ( "<type>" . to_owned ( ) , Applicability :: HasPlaceholders )
654+ ( "<type>" , Applicability :: HasPlaceholders )
655655 } ;
656656
657657 lint. build (
@@ -1132,17 +1132,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds {
11321132 let mut suggested_changing_assoc_types = false ;
11331133 // There must not be a where clause
11341134 if !type_alias_generics. where_clause . predicates . is_empty ( ) {
1135- let spans: Vec < _ > = type_alias_generics
1136- . where_clause
1137- . predicates
1138- . iter ( )
1139- . map ( |pred| pred. span ( ) )
1140- . collect ( ) ;
1141- cx. struct_span_lint (
1135+ cx. lint (
11421136 TYPE_ALIAS_BOUNDS ,
1143- spans,
11441137 |lint| {
11451138 let mut err = lint. build ( "where clauses are not enforced in type aliases" ) ;
1139+ let spans: Vec < _ > = type_alias_generics
1140+ . where_clause
1141+ . predicates
1142+ . iter ( )
1143+ . map ( |pred| pred. span ( ) )
1144+ . collect ( ) ;
1145+ err. set_span ( spans) ;
11461146 err. span_suggestion (
11471147 type_alias_generics. where_clause . span_for_predicates_or_empty_place ( ) ,
11481148 "the clause will not be checked when the type alias is used, and should be removed" ,
0 commit comments