@@ -13,7 +13,7 @@ use rustc_span::{symbol, Span, Symbol, DUMMY_SP};
13
13
14
14
/// How a lint level was set.
15
15
#[ derive( Clone , Copy , PartialEq , Eq , HashStable ) ]
16
- pub enum LintSource {
16
+ pub enum LintLevelSource {
17
17
/// Lint is at the default level as declared
18
18
/// in rustc or a plugin.
19
19
Default ,
@@ -27,25 +27,26 @@ pub enum LintSource {
27
27
CommandLine ( Symbol , Level ) ,
28
28
}
29
29
30
- impl LintSource {
30
+ impl LintLevelSource {
31
31
pub fn name ( & self ) -> Symbol {
32
32
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,
36
36
}
37
37
}
38
38
39
39
pub fn span ( & self ) -> Span {
40
40
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 ,
44
44
}
45
45
}
46
46
}
47
47
48
- pub type LevelSource = ( Level , LintSource ) ;
48
+ /// A tuple of a lint level and its source.
49
+ pub type LevelSource = ( Level , LintLevelSource ) ;
49
50
50
51
pub struct LintLevelSets {
51
52
pub list : Vec < LintSet > ,
@@ -113,7 +114,7 @@ impl LintLevelSets {
113
114
id : LintId ,
114
115
mut idx : u32 ,
115
116
aux : Option < & FxHashMap < LintId , LevelSource > > ,
116
- ) -> ( Option < Level > , LintSource ) {
117
+ ) -> ( Option < Level > , LintLevelSource ) {
117
118
if let Some ( specs) = aux {
118
119
if let Some ( & ( level, src) ) = specs. get ( & id) {
119
120
return ( Some ( level) , src) ;
@@ -125,7 +126,7 @@ impl LintLevelSets {
125
126
if let Some ( & ( level, src) ) = specs. get ( & id) {
126
127
return ( Some ( level) , src) ;
127
128
}
128
- return ( None , LintSource :: Default ) ;
129
+ return ( None , LintLevelSource :: Default ) ;
129
130
}
130
131
LintSet :: Node { ref specs, parent } => {
131
132
if let Some ( & ( level, src) ) = specs. get ( & id) {
@@ -213,7 +214,7 @@ pub fn struct_lint_level<'s, 'd>(
213
214
sess : & ' s Session ,
214
215
lint : & ' static Lint ,
215
216
level : Level ,
216
- src : LintSource ,
217
+ src : LintLevelSource ,
217
218
span : Option < MultiSpan > ,
218
219
decorate : impl for < ' a > FnOnce ( LintDiagnosticBuilder < ' a > ) + ' d ,
219
220
) {
@@ -223,7 +224,7 @@ pub fn struct_lint_level<'s, 'd>(
223
224
sess : & ' s Session ,
224
225
lint : & ' static Lint ,
225
226
level : Level ,
226
- src : LintSource ,
227
+ src : LintLevelSource ,
227
228
span : Option < MultiSpan > ,
228
229
decorate : Box < dyn for < ' b > FnOnce ( LintDiagnosticBuilder < ' b > ) + ' d > ,
229
230
) {
@@ -274,14 +275,14 @@ pub fn struct_lint_level<'s, 'd>(
274
275
275
276
let name = lint. name_lower ( ) ;
276
277
match src {
277
- LintSource :: Default => {
278
+ LintLevelSource :: Default => {
278
279
sess. diag_note_once (
279
280
& mut err,
280
281
DiagnosticMessageId :: from ( lint) ,
281
282
& format ! ( "`#[{}({})]` on by default" , level. as_str( ) , name) ,
282
283
) ;
283
284
}
284
- LintSource :: CommandLine ( lint_flag_val, orig_level) => {
285
+ LintLevelSource :: CommandLine ( lint_flag_val, orig_level) => {
285
286
let flag = match orig_level {
286
287
Level :: Warn => "-W" ,
287
288
Level :: Deny => "-D" ,
@@ -310,7 +311,7 @@ pub fn struct_lint_level<'s, 'd>(
310
311
) ;
311
312
}
312
313
}
313
- LintSource :: Node ( lint_attr_name, src, reason) => {
314
+ LintLevelSource :: Node ( lint_attr_name, src, reason) => {
314
315
if let Some ( rationale) = reason {
315
316
err. note ( & rationale. as_str ( ) ) ;
316
317
}
0 commit comments