@@ -307,6 +307,10 @@ impl Lint {
307
307
. map ( |( _, ( l, r, _) ) | ( l, r) )
308
308
. unwrap ( )
309
309
}
310
+
311
+ fn emitted_source ( & self , lint_level : LintLevel , reason : LintLevelReason ) -> String {
312
+ format ! ( "`cargo::{}` is set to `{lint_level}` {reason}" , self . name, )
313
+ }
310
314
}
311
315
312
316
#[ derive( Copy , Clone , Debug , PartialEq ) ]
@@ -449,10 +453,7 @@ pub fn check_im_a_teapot(
449
453
}
450
454
let level = lint_level. to_diagnostic_level ( ) ;
451
455
let manifest_path = rel_cwd_manifest_path ( path, gctx) ;
452
- let emitted_reason = format ! (
453
- "`cargo::{}` is set to `{lint_level}` {reason}" ,
454
- IM_A_TEAPOT . name
455
- ) ;
456
+ let emitted_reason = IM_A_TEAPOT . emitted_source ( lint_level, reason) ;
456
457
457
458
let key_span = get_span ( manifest. document ( ) , & [ "package" , "im-a-teapot" ] , false ) . unwrap ( ) ;
458
459
let value_span = get_span ( manifest. document ( ) , & [ "package" , "im-a-teapot" ] , true ) . unwrap ( ) ;
@@ -581,10 +582,7 @@ fn output_unknown_lints(
581
582
} ;
582
583
583
584
if emitted_source. is_none ( ) {
584
- emitted_source = Some ( format ! (
585
- "`cargo::{}` is set to `{lint_level}` {reason}" ,
586
- UNKNOWN_LINTS . name
587
- ) ) ;
585
+ emitted_source = Some ( UNKNOWN_LINTS . emitted_source ( lint_level, reason) ) ;
588
586
message = message. footer ( Level :: Note . title ( emitted_source. as_ref ( ) . unwrap ( ) ) ) ;
589
587
}
590
588
0 commit comments