@@ -969,24 +969,6 @@ impl DeprecatedAttr {
969
969
}
970
970
}
971
971
972
- fn lint_deprecated_attr (
973
- cx : & EarlyContext < ' _ > ,
974
- attr : & ast:: Attribute ,
975
- msg : & str ,
976
- suggestion : Option < & str > ,
977
- ) {
978
- cx. struct_span_lint ( DEPRECATED , attr. span , |lint| {
979
- lint. build ( msg)
980
- . span_suggestion_short (
981
- attr. span ,
982
- suggestion. unwrap_or ( "remove this attribute" ) ,
983
- "" ,
984
- Applicability :: MachineApplicable ,
985
- )
986
- . emit ( ) ;
987
- } )
988
- }
989
-
990
972
impl EarlyLintPass for DeprecatedAttr {
991
973
fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & ast:: Attribute ) {
992
974
for BuiltinAttribute { name, gate, .. } in & self . depr_attrs {
@@ -998,17 +980,38 @@ impl EarlyLintPass for DeprecatedAttr {
998
980
_,
999
981
) = gate
1000
982
{
1001
- let msg =
1002
- format ! ( "use of deprecated attribute `{}`: {}. See {}" , name, reason, link) ;
1003
- lint_deprecated_attr ( cx, attr, & msg, suggestion) ;
983
+ cx. struct_span_lint ( DEPRECATED , attr. span , |lint| {
984
+ // FIXME(davidtwco) translatable deprecated attr
985
+ lint. build ( fluent:: lint:: builtin_deprecated_attr_link)
986
+ . set_arg ( "name" , name)
987
+ . set_arg ( "reason" , reason)
988
+ . set_arg ( "link" , link)
989
+ . span_suggestion_short (
990
+ attr. span ,
991
+ suggestion. map ( |s| s. into ( ) ) . unwrap_or (
992
+ fluent:: lint:: builtin_deprecated_attr_default_suggestion,
993
+ ) ,
994
+ "" ,
995
+ Applicability :: MachineApplicable ,
996
+ )
997
+ . emit ( ) ;
998
+ } ) ;
1004
999
}
1005
1000
return ;
1006
1001
}
1007
1002
}
1008
1003
if attr. has_name ( sym:: no_start) || attr. has_name ( sym:: crate_id) {
1009
- let path_str = pprust:: path_to_string ( & attr. get_normal_item ( ) . path ) ;
1010
- let msg = format ! ( "use of deprecated attribute `{}`: no longer used." , path_str) ;
1011
- lint_deprecated_attr ( cx, attr, & msg, None ) ;
1004
+ cx. struct_span_lint ( DEPRECATED , attr. span , |lint| {
1005
+ lint. build ( fluent:: lint:: builtin_deprecated_attr_used)
1006
+ . set_arg ( "name" , pprust:: path_to_string ( & attr. get_normal_item ( ) . path ) )
1007
+ . span_suggestion_short (
1008
+ attr. span ,
1009
+ fluent:: lint:: builtin_deprecated_attr_default_suggestion,
1010
+ "" ,
1011
+ Applicability :: MachineApplicable ,
1012
+ )
1013
+ . emit ( ) ;
1014
+ } ) ;
1012
1015
}
1013
1016
}
1014
1017
}
0 commit comments