@@ -12,7 +12,7 @@ use rustc_session::lint::{
1212 builtin:: { self , FORBIDDEN_LINT_GROUPS } ,
1313 FutureIncompatibilityReason , Level , Lint , LintExpectationId , LintId ,
1414} ;
15- use rustc_session:: { DiagnosticMessageId , Session } ;
15+ use rustc_session:: Session ;
1616use rustc_span:: hygiene:: MacroKind ;
1717use rustc_span:: source_map:: { DesugaringKind , ExpnKind , MultiSpan } ;
1818use rustc_span:: { symbol, Span , Symbol , DUMMY_SP } ;
@@ -245,7 +245,6 @@ impl<'a> LintDiagnosticBuilder<'a, ErrorGuaranteed> {
245245}
246246
247247pub fn explain_lint_level_source (
248- sess : & Session ,
249248 lint : & ' static Lint ,
250249 level : Level ,
251250 src : LintLevelSource ,
@@ -254,11 +253,7 @@ pub fn explain_lint_level_source(
254253 let name = lint. name_lower ( ) ;
255254 match src {
256255 LintLevelSource :: Default => {
257- sess. diag_note_once (
258- err,
259- DiagnosticMessageId :: from ( lint) ,
260- & format ! ( "`#[{}({})]` on by default" , level. as_str( ) , name) ,
261- ) ;
256+ err. note_once ( & format ! ( "`#[{}({})]` on by default" , level. as_str( ) , name) ) ;
262257 }
263258 LintLevelSource :: CommandLine ( lint_flag_val, orig_level) => {
264259 let flag = match orig_level {
@@ -273,46 +268,29 @@ pub fn explain_lint_level_source(
273268 } ;
274269 let hyphen_case_lint_name = name. replace ( '_' , "-" ) ;
275270 if lint_flag_val. as_str ( ) == name {
276- sess. diag_note_once (
277- err,
278- DiagnosticMessageId :: from ( lint) ,
279- & format ! (
280- "requested on the command line with `{} {}`" ,
281- flag, hyphen_case_lint_name
282- ) ,
283- ) ;
271+ err. note_once ( & format ! (
272+ "requested on the command line with `{} {}`" ,
273+ flag, hyphen_case_lint_name
274+ ) ) ;
284275 } else {
285276 let hyphen_case_flag_val = lint_flag_val. as_str ( ) . replace ( '_' , "-" ) ;
286- sess. diag_note_once (
287- err,
288- DiagnosticMessageId :: from ( lint) ,
289- & format ! (
290- "`{} {}` implied by `{} {}`" ,
291- flag, hyphen_case_lint_name, flag, hyphen_case_flag_val
292- ) ,
293- ) ;
277+ err. note_once ( & format ! (
278+ "`{} {}` implied by `{} {}`" ,
279+ flag, hyphen_case_lint_name, flag, hyphen_case_flag_val
280+ ) ) ;
294281 }
295282 }
296283 LintLevelSource :: Node ( lint_attr_name, src, reason) => {
297284 if let Some ( rationale) = reason {
298285 err. note ( rationale. as_str ( ) ) ;
299286 }
300- sess. diag_span_note_once (
301- err,
302- DiagnosticMessageId :: from ( lint) ,
303- src,
304- "the lint level is defined here" ,
305- ) ;
287+ err. span_note_once ( src, "the lint level is defined here" ) ;
306288 if lint_attr_name. as_str ( ) != name {
307289 let level_str = level. as_str ( ) ;
308- sess. diag_note_once (
309- err,
310- DiagnosticMessageId :: from ( lint) ,
311- & format ! (
312- "`#[{}({})]` implied by `#[{}({})]`" ,
313- level_str, name, level_str, lint_attr_name
314- ) ,
315- ) ;
290+ err. note_once ( & format ! (
291+ "`#[{}({})]` implied by `#[{}({})]`" ,
292+ level_str, name, level_str, lint_attr_name
293+ ) ) ;
316294 }
317295 }
318296 }
@@ -412,7 +390,7 @@ pub fn struct_lint_level<'s, 'd>(
412390 return ;
413391 }
414392
415- explain_lint_level_source ( sess , lint, level, src, & mut err) ;
393+ explain_lint_level_source ( lint, level, src, & mut err) ;
416394
417395 let name = lint. name_lower ( ) ;
418396 let is_force_warn = matches ! ( level, Level :: ForceWarn ) ;
0 commit comments