1
1
use std:: cmp;
2
2
3
3
use crate :: ich:: StableHashingContext ;
4
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
4
+ use rustc_data_structures:: fx:: FxHashMap ;
5
5
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
6
6
use rustc_errors:: { DiagnosticBuilder , DiagnosticId } ;
7
7
use rustc_hir:: HirId ;
@@ -28,9 +28,6 @@ pub enum LintLevelSource {
28
28
/// The provided `Level` is the level specified on the command line.
29
29
/// (The actual level may be lower due to `--cap-lints`.)
30
30
CommandLine ( Symbol , Level ) ,
31
-
32
- /// Lint is being forced to warn no matter what.
33
- ForceWarn ( Symbol ) ,
34
31
}
35
32
36
33
impl LintLevelSource {
@@ -39,7 +36,6 @@ impl LintLevelSource {
39
36
LintLevelSource :: Default => symbol:: kw:: Default ,
40
37
LintLevelSource :: Node ( name, _, _) => name,
41
38
LintLevelSource :: CommandLine ( name, _) => name,
42
- LintLevelSource :: ForceWarn ( name) => name,
43
39
}
44
40
}
45
41
@@ -48,7 +44,6 @@ impl LintLevelSource {
48
44
LintLevelSource :: Default => DUMMY_SP ,
49
45
LintLevelSource :: Node ( _, span, _) => span,
50
46
LintLevelSource :: CommandLine ( _, _) => DUMMY_SP ,
51
- LintLevelSource :: ForceWarn ( _) => DUMMY_SP ,
52
47
}
53
48
}
54
49
}
@@ -60,7 +55,6 @@ pub type LevelAndSource = (Level, LintLevelSource);
60
55
pub struct LintLevelSets {
61
56
pub list : Vec < LintSet > ,
62
57
pub lint_cap : Level ,
63
- pub force_warns : FxHashSet < LintId > ,
64
58
}
65
59
66
60
#[ derive( Debug ) ]
@@ -79,11 +73,7 @@ pub enum LintSet {
79
73
80
74
impl LintLevelSets {
81
75
pub fn new ( ) -> Self {
82
- LintLevelSets {
83
- list : Vec :: new ( ) ,
84
- lint_cap : Level :: Forbid ,
85
- force_warns : FxHashSet :: default ( ) ,
86
- }
76
+ LintLevelSets { list : Vec :: new ( ) , lint_cap : Level :: Forbid }
87
77
}
88
78
89
79
pub fn get_lint_level (
@@ -93,11 +83,6 @@ impl LintLevelSets {
93
83
aux : Option < & FxHashMap < LintId , LevelAndSource > > ,
94
84
sess : & Session ,
95
85
) -> LevelAndSource {
96
- // Check whether we should always warn
97
- if self . force_warns . contains ( & LintId :: of ( lint) ) {
98
- return ( Level :: Warn , LintLevelSource :: ForceWarn ( Symbol :: intern ( lint. name ) ) ) ;
99
- }
100
-
101
86
let ( level, mut src) = self . get_lint_id_level ( LintId :: of ( lint) , idx, aux) ;
102
87
103
88
// If `level` is none then we actually assume the default level for this
@@ -191,11 +176,11 @@ impl LintLevelMap {
191
176
impl < ' a > HashStable < StableHashingContext < ' a > > for LintLevelMap {
192
177
#[ inline]
193
178
fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
194
- let LintLevelMap { ref sets, ref id_to_set, .. } = * self ;
179
+ let LintLevelMap { ref sets, ref id_to_set } = * self ;
195
180
196
181
id_to_set. hash_stable ( hcx, hasher) ;
197
182
198
- let LintLevelSets { ref list, lint_cap, .. } = * sets;
183
+ let LintLevelSets { ref list, lint_cap } = * sets;
199
184
200
185
lint_cap. hash_stable ( hcx, hasher) ;
201
186
@@ -273,8 +258,8 @@ pub fn struct_lint_level<'s, 'd>(
273
258
return ;
274
259
}
275
260
}
276
- ( Level :: Warn , Some ( span) ) => sess. struct_span_warn ( span, "" ) ,
277
- ( Level :: Warn , None ) => sess. struct_warn ( "" ) ,
261
+ ( Level :: Warn | Level :: ForceWarn , Some ( span) ) => sess. struct_span_warn ( span, "" ) ,
262
+ ( Level :: Warn | Level :: ForceWarn , None ) => sess. struct_warn ( "" ) ,
278
263
( Level :: Deny | Level :: Forbid , Some ( span) ) => sess. struct_span_err ( span, "" ) ,
279
264
( Level :: Deny | Level :: Forbid , None ) => sess. struct_err ( "" ) ,
280
265
} ;
@@ -316,6 +301,7 @@ pub fn struct_lint_level<'s, 'd>(
316
301
Level :: Deny => "-D" ,
317
302
Level :: Forbid => "-F" ,
318
303
Level :: Allow => "-A" ,
304
+ Level :: ForceWarn => "--force-warns" ,
319
305
} ;
320
306
let hyphen_case_lint_name = name. replace ( "_" , "-" ) ;
321
307
if lint_flag_val. as_str ( ) == name {
@@ -361,13 +347,6 @@ pub fn struct_lint_level<'s, 'd>(
361
347
) ;
362
348
}
363
349
}
364
- LintLevelSource :: ForceWarn ( _) => {
365
- sess. diag_note_once (
366
- & mut err,
367
- DiagnosticMessageId :: from ( lint) ,
368
- "warning forced by `force-warns` commandline option" ,
369
- ) ;
370
- }
371
350
}
372
351
373
352
err. code ( DiagnosticId :: Lint { name, has_future_breakage } ) ;
0 commit comments