@@ -969,24 +969,6 @@ impl DeprecatedAttr {
969969 }
970970}
971971
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-
990972impl EarlyLintPass for DeprecatedAttr {
991973 fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & ast:: Attribute ) {
992974 for BuiltinAttribute { name, gate, .. } in & self . depr_attrs {
@@ -998,17 +980,38 @@ impl EarlyLintPass for DeprecatedAttr {
998980 _,
999981 ) = gate
1000982 {
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+ } ) ;
1004999 }
10051000 return ;
10061001 }
10071002 }
10081003 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+ } ) ;
10121015 }
10131016 }
10141017}
0 commit comments