@@ -12,7 +12,7 @@ use rustc_session::lint::{
12
12
builtin:: { self , FORBIDDEN_LINT_GROUPS } ,
13
13
FutureIncompatibilityReason , Level , Lint , LintExpectationId , LintId ,
14
14
} ;
15
- use rustc_session:: { DiagnosticMessageId , Session } ;
15
+ use rustc_session:: Session ;
16
16
use rustc_span:: hygiene:: MacroKind ;
17
17
use rustc_span:: source_map:: { DesugaringKind , ExpnKind , MultiSpan } ;
18
18
use rustc_span:: { symbol, Span , Symbol , DUMMY_SP } ;
@@ -245,7 +245,6 @@ impl<'a> LintDiagnosticBuilder<'a, ErrorGuaranteed> {
245
245
}
246
246
247
247
pub fn explain_lint_level_source (
248
- sess : & Session ,
249
248
lint : & ' static Lint ,
250
249
level : Level ,
251
250
src : LintLevelSource ,
@@ -254,11 +253,7 @@ pub fn explain_lint_level_source(
254
253
let name = lint. name_lower ( ) ;
255
254
match src {
256
255
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) ) ;
262
257
}
263
258
LintLevelSource :: CommandLine ( lint_flag_val, orig_level) => {
264
259
let flag = match orig_level {
@@ -273,46 +268,29 @@ pub fn explain_lint_level_source(
273
268
} ;
274
269
let hyphen_case_lint_name = name. replace ( '_' , "-" ) ;
275
270
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
+ ) ) ;
284
275
} else {
285
276
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
+ ) ) ;
294
281
}
295
282
}
296
283
LintLevelSource :: Node ( lint_attr_name, src, reason) => {
297
284
if let Some ( rationale) = reason {
298
285
err. note ( rationale. as_str ( ) ) ;
299
286
}
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" ) ;
306
288
if lint_attr_name. as_str ( ) != name {
307
289
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
+ ) ) ;
316
294
}
317
295
}
318
296
}
@@ -412,7 +390,7 @@ pub fn struct_lint_level<'s, 'd>(
412
390
return ;
413
391
}
414
392
415
- explain_lint_level_source ( sess , lint, level, src, & mut err) ;
393
+ explain_lint_level_source ( lint, level, src, & mut err) ;
416
394
417
395
let name = lint. name_lower ( ) ;
418
396
let is_force_warn = matches ! ( level, Level :: ForceWarn ) ;
0 commit comments