@@ -13,7 +13,7 @@ use rustc_span::{symbol, Span, Symbol, DUMMY_SP};
1313
1414/// How a lint level was set.
1515#[ derive( Clone , Copy , PartialEq , Eq , HashStable ) ]
16- pub enum LintSource {
16+ pub enum LintLevelSource {
1717 /// Lint is at the default level as declared
1818 /// in rustc or a plugin.
1919 Default ,
@@ -27,25 +27,26 @@ pub enum LintSource {
2727 CommandLine ( Symbol , Level ) ,
2828}
2929
30- impl LintSource {
30+ impl LintLevelSource {
3131 pub fn name ( & self ) -> Symbol {
3232 match * self {
33- LintSource :: Default => symbol:: kw:: Default ,
34- LintSource :: Node ( name, _, _) => name,
35- LintSource :: CommandLine ( name, _) => name,
33+ LintLevelSource :: Default => symbol:: kw:: Default ,
34+ LintLevelSource :: Node ( name, _, _) => name,
35+ LintLevelSource :: CommandLine ( name, _) => name,
3636 }
3737 }
3838
3939 pub fn span ( & self ) -> Span {
4040 match * self {
41- LintSource :: Default => DUMMY_SP ,
42- LintSource :: Node ( _, span, _) => span,
43- LintSource :: CommandLine ( _, _) => DUMMY_SP ,
41+ LintLevelSource :: Default => DUMMY_SP ,
42+ LintLevelSource :: Node ( _, span, _) => span,
43+ LintLevelSource :: CommandLine ( _, _) => DUMMY_SP ,
4444 }
4545 }
4646}
4747
48- pub type LevelSource = ( Level , LintSource ) ;
48+ /// A tuple of a lint level and its source.
49+ pub type LevelSource = ( Level , LintLevelSource ) ;
4950
5051pub struct LintLevelSets {
5152 pub list : Vec < LintSet > ,
@@ -113,7 +114,7 @@ impl LintLevelSets {
113114 id : LintId ,
114115 mut idx : u32 ,
115116 aux : Option < & FxHashMap < LintId , LevelSource > > ,
116- ) -> ( Option < Level > , LintSource ) {
117+ ) -> ( Option < Level > , LintLevelSource ) {
117118 if let Some ( specs) = aux {
118119 if let Some ( & ( level, src) ) = specs. get ( & id) {
119120 return ( Some ( level) , src) ;
@@ -125,7 +126,7 @@ impl LintLevelSets {
125126 if let Some ( & ( level, src) ) = specs. get ( & id) {
126127 return ( Some ( level) , src) ;
127128 }
128- return ( None , LintSource :: Default ) ;
129+ return ( None , LintLevelSource :: Default ) ;
129130 }
130131 LintSet :: Node { ref specs, parent } => {
131132 if let Some ( & ( level, src) ) = specs. get ( & id) {
@@ -213,7 +214,7 @@ pub fn struct_lint_level<'s, 'd>(
213214 sess : & ' s Session ,
214215 lint : & ' static Lint ,
215216 level : Level ,
216- src : LintSource ,
217+ src : LintLevelSource ,
217218 span : Option < MultiSpan > ,
218219 decorate : impl for < ' a > FnOnce ( LintDiagnosticBuilder < ' a > ) + ' d ,
219220) {
@@ -223,7 +224,7 @@ pub fn struct_lint_level<'s, 'd>(
223224 sess : & ' s Session ,
224225 lint : & ' static Lint ,
225226 level : Level ,
226- src : LintSource ,
227+ src : LintLevelSource ,
227228 span : Option < MultiSpan > ,
228229 decorate : Box < dyn for < ' b > FnOnce ( LintDiagnosticBuilder < ' b > ) + ' d > ,
229230 ) {
@@ -274,14 +275,14 @@ pub fn struct_lint_level<'s, 'd>(
274275
275276 let name = lint. name_lower ( ) ;
276277 match src {
277- LintSource :: Default => {
278+ LintLevelSource :: Default => {
278279 sess. diag_note_once (
279280 & mut err,
280281 DiagnosticMessageId :: from ( lint) ,
281282 & format ! ( "`#[{}({})]` on by default" , level. as_str( ) , name) ,
282283 ) ;
283284 }
284- LintSource :: CommandLine ( lint_flag_val, orig_level) => {
285+ LintLevelSource :: CommandLine ( lint_flag_val, orig_level) => {
285286 let flag = match orig_level {
286287 Level :: Warn => "-W" ,
287288 Level :: Deny => "-D" ,
@@ -310,7 +311,7 @@ pub fn struct_lint_level<'s, 'd>(
310311 ) ;
311312 }
312313 }
313- LintSource :: Node ( lint_attr_name, src, reason) => {
314+ LintLevelSource :: Node ( lint_attr_name, src, reason) => {
314315 if let Some ( rationale) = reason {
315316 err. note ( & rationale. as_str ( ) ) ;
316317 }
0 commit comments