@@ -924,17 +924,16 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
924
924
origin,
925
925
..
926
926
} ) => {
927
-
928
927
let ( bound_vars, binders) : ( FxIndexMap < LocalDefId , ResolvedArg > , Vec < _ > ) =
929
928
bound_generic_params
930
- . iter ( )
931
- . enumerate ( )
932
- . map ( |( late_bound_idx, param) | {
933
- let pair = ResolvedArg :: late ( late_bound_idx as u32 , param) ;
934
- let r = late_arg_as_bound_arg ( this. tcx , & pair. 1 , param) ;
935
- ( pair, r)
936
- } )
937
- . unzip ( ) ;
929
+ . iter ( )
930
+ . enumerate ( )
931
+ . map ( |( late_bound_idx, param) | {
932
+ let pair = ResolvedArg :: late ( late_bound_idx as u32 , param) ;
933
+ let r = late_arg_as_bound_arg ( this. tcx , & pair. 1 , param) ;
934
+ ( pair, r)
935
+ } )
936
+ . unzip ( ) ;
938
937
this. record_late_bound_vars ( hir_id, binders. clone ( ) ) ;
939
938
// Even if there are no lifetimes defined here, we still wrap it in a binder
940
939
// scope. If there happens to be a nested poly trait ref (an error), that
@@ -968,23 +967,21 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
968
967
if lt. res != hir:: LifetimeName :: Static {
969
968
continue ;
970
969
}
971
- this. insert_lifetime ( lt, Region :: Static ) ;
970
+ this. insert_lifetime ( lt, ResolvedArg :: StaticLifetime ) ;
972
971
this. tcx . struct_span_lint_hir (
973
972
lint:: builtin:: NAMED_STATIC_LIFETIMES ,
974
973
lifetime. hir_id ,
975
- lifetime. span ,
974
+ lifetime. ident . span ,
975
+ format ! (
976
+ "unnecessary lifetime parameter `{}`" ,
977
+ lifetime. ident
978
+ ) ,
976
979
|lint| {
977
- let msg = & format ! (
978
- "unnecessary lifetime parameter `{}`" ,
979
- lifetime. name. ident( ) ,
980
- ) ;
981
980
let help = & format ! (
982
981
"you can use the `'static` lifetime directly, in place of `{}`" ,
983
- lifetime. name . ident( ) ,
982
+ lifetime. ident,
984
983
) ;
985
- lint. build ( msg)
986
- . help ( help)
987
- . emit ( ) ;
984
+ lint. note ( help)
988
985
} ,
989
986
) ;
990
987
}
0 commit comments