26
26
//! ```
27
27
28
28
use rustc_data_structures:: fx:: FxHashMap ;
29
+ use rustc_errors:: { DiagnosticMessage , SubdiagnosticMessage } ;
29
30
use rustc_hir:: def_id:: DefId ;
30
31
use rustc_middle:: ty:: TyCtxt ;
31
32
pub ( crate ) use rustc_resolve:: rustdoc:: main_body_opts;
@@ -808,7 +809,7 @@ impl<'tcx> ExtraInfo<'tcx> {
808
809
ExtraInfo { def_id, sp, tcx }
809
810
}
810
811
811
- fn error_invalid_codeblock_attr ( & self , msg : & str ) {
812
+ fn error_invalid_codeblock_attr ( & self , msg : impl Into < DiagnosticMessage > ) {
812
813
if let Some ( def_id) = self . def_id . as_local ( ) {
813
814
self . tcx . struct_span_lint_hir (
814
815
crate :: lint:: INVALID_CODEBLOCK_ATTRIBUTES ,
@@ -820,7 +821,11 @@ impl<'tcx> ExtraInfo<'tcx> {
820
821
}
821
822
}
822
823
823
- fn error_invalid_codeblock_attr_with_help ( & self , msg : & str , help : & str ) {
824
+ fn error_invalid_codeblock_attr_with_help (
825
+ & self ,
826
+ msg : impl Into < DiagnosticMessage > ,
827
+ help : impl Into < SubdiagnosticMessage > ,
828
+ ) {
824
829
if let Some ( def_id) = self . def_id . as_local ( ) {
825
830
self . tcx . struct_span_lint_hir (
826
831
crate :: lint:: INVALID_CODEBLOCK_ATTRIBUTES ,
@@ -1246,7 +1251,7 @@ impl LangString {
1246
1251
} {
1247
1252
if let Some ( extra) = extra {
1248
1253
extra. error_invalid_codeblock_attr_with_help (
1249
- & format ! ( "unknown attribute `{}`. Did you mean `{}`?" , x , flag ) ,
1254
+ format ! ( "unknown attribute `{x }`. Did you mean `{flag }`?" ) ,
1250
1255
help,
1251
1256
) ;
1252
1257
}
@@ -1263,9 +1268,8 @@ impl LangString {
1263
1268
if key == "class" {
1264
1269
data. added_classes . push ( value. to_owned ( ) ) ;
1265
1270
} else if let Some ( extra) = extra {
1266
- extra. error_invalid_codeblock_attr ( & format ! (
1267
- "unsupported attribute `{key}`"
1268
- ) ) ;
1271
+ extra
1272
+ . error_invalid_codeblock_attr ( format ! ( "unsupported attribute `{key}`" ) ) ;
1269
1273
}
1270
1274
}
1271
1275
LangStringToken :: ClassAttribute ( class) => {
0 commit comments