@@ -673,7 +673,7 @@ impl DiagCtxt {
673673 let key = ( span. with_parent ( None ) , key) ;
674674
675675 if diag. is_error ( ) {
676- if matches ! ( diag. level, Level :: Error { lint: true } ) {
676+ if matches ! ( diag. level, Error { lint: true } ) {
677677 inner. lint_err_count += 1 ;
678678 } else {
679679 inner. err_count += 1 ;
@@ -697,7 +697,7 @@ impl DiagCtxt {
697697 let key = ( span. with_parent ( None ) , key) ;
698698 let diag = inner. stashed_diagnostics . remove ( & key) ?;
699699 if diag. is_error ( ) {
700- if matches ! ( diag. level, Level :: Error { lint: true } ) {
700+ if matches ! ( diag. level, Error { lint: true } ) {
701701 inner. lint_err_count -= 1 ;
702702 } else {
703703 inner. err_count -= 1 ;
@@ -759,14 +759,14 @@ impl DiagCtxt {
759759 #[ rustc_lint_diagnostics]
760760 #[ track_caller]
761761 pub fn struct_warn ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , ( ) > {
762- DiagnosticBuilder :: new ( self , Level :: Warning ( None ) , msg)
762+ DiagnosticBuilder :: new ( self , Warning ( None ) , msg)
763763 }
764764
765765 /// Construct a builder at the `Allow` level with the `msg`.
766766 #[ rustc_lint_diagnostics]
767767 #[ track_caller]
768768 pub fn struct_allow ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , ( ) > {
769- DiagnosticBuilder :: new ( self , Level :: Allow , msg)
769+ DiagnosticBuilder :: new ( self , Allow , msg)
770770 }
771771
772772 /// Construct a builder at the `Expect` level with the `msg`.
@@ -777,7 +777,7 @@ impl DiagCtxt {
777777 msg : impl Into < DiagnosticMessage > ,
778778 id : LintExpectationId ,
779779 ) -> DiagnosticBuilder < ' _ , ( ) > {
780- DiagnosticBuilder :: new ( self , Level :: Expect ( id) , msg)
780+ DiagnosticBuilder :: new ( self , Expect ( id) , msg)
781781 }
782782
783783 /// Construct a builder at the `Error` level at the given `span` and with the `msg`.
@@ -812,7 +812,7 @@ impl DiagCtxt {
812812 #[ rustc_lint_diagnostics]
813813 #[ track_caller]
814814 pub fn struct_err ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ > {
815- DiagnosticBuilder :: new ( self , Level :: Error { lint : false } , msg)
815+ DiagnosticBuilder :: new ( self , Error { lint : false } , msg)
816816 }
817817
818818 /// Construct a builder at the `Error` level with the `msg` and the `code`.
@@ -875,7 +875,7 @@ impl DiagCtxt {
875875 & self ,
876876 msg : impl Into < DiagnosticMessage > ,
877877 ) -> DiagnosticBuilder < ' _ , FatalAbort > {
878- DiagnosticBuilder :: new ( self , Level :: Fatal , msg)
878+ DiagnosticBuilder :: new ( self , Fatal , msg)
879879 }
880880
881881 /// Construct a builder at the `Fatal` level with the `msg`, that doesn't abort.
@@ -885,27 +885,27 @@ impl DiagCtxt {
885885 & self ,
886886 msg : impl Into < DiagnosticMessage > ,
887887 ) -> DiagnosticBuilder < ' _ , FatalError > {
888- DiagnosticBuilder :: new ( self , Level :: Fatal , msg)
888+ DiagnosticBuilder :: new ( self , Fatal , msg)
889889 }
890890
891891 /// Construct a builder at the `Help` level with the `msg`.
892892 #[ rustc_lint_diagnostics]
893893 pub fn struct_help ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , ( ) > {
894- DiagnosticBuilder :: new ( self , Level :: Help , msg)
894+ DiagnosticBuilder :: new ( self , Help , msg)
895895 }
896896
897897 /// Construct a builder at the `Note` level with the `msg`.
898898 #[ rustc_lint_diagnostics]
899899 #[ track_caller]
900900 pub fn struct_note ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , ( ) > {
901- DiagnosticBuilder :: new ( self , Level :: Note , msg)
901+ DiagnosticBuilder :: new ( self , Note , msg)
902902 }
903903
904904 /// Construct a builder at the `Bug` level with the `msg`.
905905 #[ rustc_lint_diagnostics]
906906 #[ track_caller]
907907 pub fn struct_bug ( & self , msg : impl Into < DiagnosticMessage > ) -> DiagnosticBuilder < ' _ , BugAbort > {
908- DiagnosticBuilder :: new ( self , Level :: Bug , msg)
908+ DiagnosticBuilder :: new ( self , Bug , msg)
909909 }
910910
911911 /// Construct a builder at the `Bug` level at the given `span` with the `msg`.
@@ -995,7 +995,7 @@ impl DiagCtxt {
995995 // FIXME: don't abort here if report_delayed_bugs is off
996996 self . span_bug ( sp, msg) ;
997997 }
998- let mut diagnostic = Diagnostic :: new ( Level :: DelayedBug , msg) ;
998+ let mut diagnostic = Diagnostic :: new ( DelayedBug , msg) ;
999999 diagnostic. set_span ( sp) ;
10001000 self . emit_diagnostic ( diagnostic) . unwrap ( )
10011001 }
@@ -1005,7 +1005,7 @@ impl DiagCtxt {
10051005 pub fn good_path_delayed_bug ( & self , msg : impl Into < DiagnosticMessage > ) {
10061006 let mut inner = self . inner . borrow_mut ( ) ;
10071007
1008- let mut diagnostic = Diagnostic :: new ( Level :: DelayedBug , msg) ;
1008+ let mut diagnostic = Diagnostic :: new ( DelayedBug , msg) ;
10091009 if inner. flags . report_delayed_bugs {
10101010 inner. emit_diagnostic_without_consuming ( & mut diagnostic) ;
10111011 }
@@ -1118,10 +1118,9 @@ impl DiagCtxt {
11181118
11191119 match ( errors. len ( ) , warnings. len ( ) ) {
11201120 ( 0 , 0 ) => return ,
1121- ( 0 , _) => inner. emitter . emit_diagnostic ( & Diagnostic :: new (
1122- Level :: Warning ( None ) ,
1123- DiagnosticMessage :: Str ( warnings) ,
1124- ) ) ,
1121+ ( 0 , _) => inner
1122+ . emitter
1123+ . emit_diagnostic ( & Diagnostic :: new ( Warning ( None ) , DiagnosticMessage :: Str ( warnings) ) ) ,
11251124 ( _, 0 ) => {
11261125 inner. emit_diagnostic ( Diagnostic :: new ( Fatal , errors) ) ;
11271126 }
@@ -1210,14 +1209,14 @@ impl DiagCtxt {
12101209
12111210 #[ track_caller]
12121211 pub fn create_err < ' a > ( & ' a self , err : impl IntoDiagnostic < ' a > ) -> DiagnosticBuilder < ' a > {
1213- err. into_diagnostic ( self , Level :: Error { lint : false } )
1212+ err. into_diagnostic ( self , Error { lint : false } )
12141213 }
12151214
12161215 pub fn create_warning < ' a > (
12171216 & ' a self ,
12181217 warning : impl IntoDiagnostic < ' a , ( ) > ,
12191218 ) -> DiagnosticBuilder < ' a , ( ) > {
1220- warning. into_diagnostic ( self , Level :: Warning ( None ) )
1219+ warning. into_diagnostic ( self , Warning ( None ) )
12211220 }
12221221
12231222 pub fn emit_warning < ' a > ( & ' a self , warning : impl IntoDiagnostic < ' a , ( ) > ) {
@@ -1228,7 +1227,7 @@ impl DiagCtxt {
12281227 & ' a self ,
12291228 fatal : impl IntoDiagnostic < ' a , FatalError > ,
12301229 ) -> DiagnosticBuilder < ' a , FatalError > {
1231- fatal. into_diagnostic ( self , Level :: Fatal )
1230+ fatal. into_diagnostic ( self , Fatal )
12321231 }
12331232
12341233 pub fn emit_almost_fatal < ' a > (
@@ -1242,7 +1241,7 @@ impl DiagCtxt {
12421241 & ' a self ,
12431242 fatal : impl IntoDiagnostic < ' a , FatalAbort > ,
12441243 ) -> DiagnosticBuilder < ' a , FatalAbort > {
1245- fatal. into_diagnostic ( self , Level :: Fatal )
1244+ fatal. into_diagnostic ( self , Fatal )
12461245 }
12471246
12481247 pub fn emit_fatal < ' a > ( & ' a self , fatal : impl IntoDiagnostic < ' a , FatalAbort > ) -> ! {
@@ -1253,7 +1252,7 @@ impl DiagCtxt {
12531252 & ' a self ,
12541253 bug : impl IntoDiagnostic < ' a , BugAbort > ,
12551254 ) -> DiagnosticBuilder < ' a , BugAbort > {
1256- bug. into_diagnostic ( self , Level :: Bug )
1255+ bug. into_diagnostic ( self , Bug )
12571256 }
12581257
12591258 pub fn emit_bug < ' a > ( & ' a self , bug : impl IntoDiagnostic < ' a , BugAbort > ) -> ! {
@@ -1268,7 +1267,7 @@ impl DiagCtxt {
12681267 & ' a self ,
12691268 note : impl IntoDiagnostic < ' a , ( ) > ,
12701269 ) -> DiagnosticBuilder < ' a , ( ) > {
1271- note. into_diagnostic ( self , Level :: Note )
1270+ note. into_diagnostic ( self , Note )
12721271 }
12731272
12741273 pub fn emit_artifact_notification ( & self , path : & Path , artifact_type : & str ) {
@@ -1355,7 +1354,7 @@ impl DiagCtxtInner {
13551354 for diag in diags {
13561355 // Decrement the count tracking the stash; emitting will increment it.
13571356 if diag. is_error ( ) {
1358- if matches ! ( diag. level, Level :: Error { lint: true } ) {
1357+ if matches ! ( diag. level, Error { lint: true } ) {
13591358 self . lint_err_count -= 1 ;
13601359 } else {
13611360 self . err_count -= 1 ;
@@ -1386,9 +1385,8 @@ impl DiagCtxtInner {
13861385 & mut self ,
13871386 diagnostic : & mut Diagnostic ,
13881387 ) -> Option < ErrorGuaranteed > {
1389- if matches ! ( diagnostic. level, Level :: Error { .. } | Level :: Fatal ) && self . treat_err_as_bug ( )
1390- {
1391- diagnostic. level = Level :: Bug ;
1388+ if matches ! ( diagnostic. level, Error { .. } | Fatal ) && self . treat_err_as_bug ( ) {
1389+ diagnostic. level = Bug ;
13921390 }
13931391
13941392 // The `LintExpectationId` can be stable or unstable depending on when it was created.
@@ -1400,7 +1398,7 @@ impl DiagCtxtInner {
14001398 return None ;
14011399 }
14021400
1403- if diagnostic. level == Level :: DelayedBug {
1401+ if diagnostic. level == DelayedBug {
14041402 // FIXME(eddyb) this should check for `has_errors` and stop pushing
14051403 // once *any* errors were emitted (and truncate `span_delayed_bugs`
14061404 // when an error is first emitted, also), but maybe there's a case
@@ -1416,7 +1414,7 @@ impl DiagCtxtInner {
14161414 }
14171415
14181416 if diagnostic. has_future_breakage ( ) {
1419- // Future breakages aren't emitted if they're Level::Allowed ,
1417+ // Future breakages aren't emitted if they're Level::Allow ,
14201418 // but they still need to be constructed and stashed below,
14211419 // so they'll trigger the good-path bug check.
14221420 self . suppressed_expected_diag = true ;
@@ -1438,7 +1436,7 @@ impl DiagCtxtInner {
14381436 return None ;
14391437 }
14401438
1441- if matches ! ( diagnostic. level, Level :: Expect ( _) | Level :: Allow ) {
1439+ if matches ! ( diagnostic. level, Expect ( _) | Allow ) {
14421440 ( * TRACK_DIAGNOSTICS ) ( diagnostic, & mut |_| { } ) ;
14431441 return None ;
14441442 }
@@ -1463,7 +1461,7 @@ impl DiagCtxtInner {
14631461 debug ! ( ?self . emitted_diagnostics) ;
14641462 let already_emitted_sub = |sub : & mut SubDiagnostic | {
14651463 debug ! ( ?sub) ;
1466- if sub. level != Level :: OnceNote && sub. level != Level :: OnceHelp {
1464+ if sub. level != OnceNote && sub. level != OnceHelp {
14671465 return false ;
14681466 }
14691467 let mut hasher = StableHasher :: new ( ) ;
@@ -1488,7 +1486,7 @@ impl DiagCtxtInner {
14881486 }
14891487 }
14901488 if diagnostic. is_error ( ) {
1491- if matches ! ( diagnostic. level, Level :: Error { lint: true } ) {
1489+ if matches ! ( diagnostic. level, Error { lint: true } ) {
14921490 self . bump_lint_err_count ( ) ;
14931491 } else {
14941492 self . bump_err_count ( ) ;
@@ -1568,15 +1566,15 @@ impl DiagCtxtInner {
15681566 if backtrace || self . ice_file . is_none ( ) { bug. decorate ( ) } else { bug. inner } ;
15691567
15701568 // "Undelay" the `DelayedBug`s (into plain `Bug`s).
1571- if bug. level != Level :: DelayedBug {
1569+ if bug. level != DelayedBug {
15721570 // NOTE(eddyb) not panicking here because we're already producing
15731571 // an ICE, and the more information the merrier.
15741572 bug. subdiagnostic ( InvalidFlushedDelayedDiagnosticLevel {
15751573 span : bug. span . primary_span ( ) . unwrap ( ) ,
15761574 level : bug. level ,
15771575 } ) ;
15781576 }
1579- bug. level = Level :: Bug ;
1577+ bug. level = Bug ;
15801578
15811579 self . emit_diagnostic ( bug) ;
15821580 }
@@ -1783,7 +1781,7 @@ impl Level {
17831781
17841782 pub fn get_expectation_id ( & self ) -> Option < LintExpectationId > {
17851783 match self {
1786- Level :: Expect ( id) | Level :: Warning ( Some ( id) ) => Some ( * id) ,
1784+ Expect ( id) | Warning ( Some ( id) ) => Some ( * id) ,
17871785 _ => None ,
17881786 }
17891787 }
0 commit comments