@@ -648,10 +648,10 @@ impl EarlyLintPass for AnonymousParameters {
648
648
cx. struct_span_lint ( ANONYMOUS_PARAMETERS , arg. pat . span , |lint| {
649
649
let ty_snip = cx. sess . source_map ( ) . span_to_snippet ( arg. ty . span ) ;
650
650
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 )
653
653
} else {
654
- ( "<type>" . to_owned ( ) , Applicability :: HasPlaceholders )
654
+ ( "<type>" , Applicability :: HasPlaceholders )
655
655
} ;
656
656
657
657
lint. build (
@@ -1132,17 +1132,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds {
1132
1132
let mut suggested_changing_assoc_types = false ;
1133
1133
// There must not be a where clause
1134
1134
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 (
1142
1136
TYPE_ALIAS_BOUNDS ,
1143
- spans,
1144
1137
|lint| {
1145
1138
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) ;
1146
1146
err. span_suggestion (
1147
1147
type_alias_generics. where_clause . span_for_predicates_or_empty_place ( ) ,
1148
1148
"the clause will not be checked when the type alias is used, and should be removed" ,
0 commit comments