2626//! ```
2727
2828use rustc_data_structures:: fx:: FxHashMap ;
29+ use rustc_errors:: { DiagnosticMessage , SubdiagnosticMessage } ;
2930use rustc_hir:: def_id:: DefId ;
3031use rustc_middle:: ty:: TyCtxt ;
3132pub ( crate ) use rustc_resolve:: rustdoc:: main_body_opts;
@@ -808,7 +809,7 @@ impl<'tcx> ExtraInfo<'tcx> {
808809 ExtraInfo { def_id, sp, tcx }
809810 }
810811
811- fn error_invalid_codeblock_attr ( & self , msg : & str ) {
812+ fn error_invalid_codeblock_attr ( & self , msg : impl Into < DiagnosticMessage > ) {
812813 if let Some ( def_id) = self . def_id . as_local ( ) {
813814 self . tcx . struct_span_lint_hir (
814815 crate :: lint:: INVALID_CODEBLOCK_ATTRIBUTES ,
@@ -820,7 +821,11 @@ impl<'tcx> ExtraInfo<'tcx> {
820821 }
821822 }
822823
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+ ) {
824829 if let Some ( def_id) = self . def_id . as_local ( ) {
825830 self . tcx . struct_span_lint_hir (
826831 crate :: lint:: INVALID_CODEBLOCK_ATTRIBUTES ,
@@ -1246,7 +1251,7 @@ impl LangString {
12461251 } {
12471252 if let Some ( extra) = extra {
12481253 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 }`?" ) ,
12501255 help,
12511256 ) ;
12521257 }
@@ -1263,9 +1268,8 @@ impl LangString {
12631268 if key == "class" {
12641269 data. added_classes . push ( value. to_owned ( ) ) ;
12651270 } 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}`" ) ) ;
12691273 }
12701274 }
12711275 LangStringToken :: ClassAttribute ( class) => {
0 commit comments