@@ -10,7 +10,6 @@ use rustc_hir as hir;
10
10
use rustc_hir:: def_id:: { CrateNum , LOCAL_CRATE } ;
11
11
use rustc_hir:: { intravisit, HirId } ;
12
12
use rustc_middle:: hir:: map:: Map ;
13
- use rustc_middle:: lint:: LevelSource ;
14
13
use rustc_middle:: lint:: LintDiagnosticBuilder ;
15
14
use rustc_middle:: lint:: { struct_lint_level, LintLevelMap , LintLevelSets , LintSet , LintSource } ;
16
15
use rustc_middle:: ty:: query:: Providers ;
@@ -97,44 +96,6 @@ impl<'s> LintLevelsBuilder<'s> {
97
96
self . sets . list . push ( LintSet :: CommandLine { specs } ) ;
98
97
}
99
98
100
- /// Attempts to insert the `id` to `level_src` map entry. If unsuccessful
101
- /// (e.g. if a forbid was already inserted on the same scope), then emits a
102
- /// diagnostic with no change to `specs`.
103
- fn insert_spec (
104
- & mut self ,
105
- specs : & mut FxHashMap < LintId , LevelSource > ,
106
- id : LintId ,
107
- ( level, src) : LevelSource ,
108
- ) {
109
- if let Some ( ( old_level, old_src) ) = specs. get ( & id) {
110
- if old_level == & Level :: Forbid && level != Level :: Forbid {
111
- let mut diag_builder = struct_span_err ! (
112
- self . sess,
113
- src. span( ) ,
114
- E0453 ,
115
- "{}({}) incompatible with previous forbid in same scope" ,
116
- level. as_str( ) ,
117
- src. name( ) ,
118
- ) ;
119
- match * old_src {
120
- LintSource :: Default => { }
121
- LintSource :: Node ( _, forbid_source_span, reason) => {
122
- diag_builder. span_label ( forbid_source_span, "`forbid` level set here" ) ;
123
- if let Some ( rationale) = reason {
124
- diag_builder. note ( & rationale. as_str ( ) ) ;
125
- }
126
- }
127
- LintSource :: CommandLine ( _, _) => {
128
- diag_builder. note ( "`forbid` lint level was set on command line" ) ;
129
- }
130
- }
131
- diag_builder. emit ( ) ;
132
- return ;
133
- }
134
- }
135
- specs. insert ( id, ( level, src) ) ;
136
- }
137
-
138
99
/// Pushes a list of AST lint attributes onto this context.
139
100
///
140
101
/// This function will return a `BuilderPush` object which should be passed
@@ -149,7 +110,7 @@ impl<'s> LintLevelsBuilder<'s> {
149
110
/// `#[allow]`
150
111
///
151
112
/// Don't forget to call `pop`!
152
- pub ( crate ) fn push (
113
+ pub fn push (
153
114
& mut self ,
154
115
attrs : & [ ast:: Attribute ] ,
155
116
store : & LintStore ,
@@ -261,7 +222,7 @@ impl<'s> LintLevelsBuilder<'s> {
261
222
let src = LintSource :: Node ( name, li. span ( ) , reason) ;
262
223
for & id in ids {
263
224
self . check_gated_lint ( id, attr. span ) ;
264
- self . insert_spec ( & mut specs , id, ( level, src) ) ;
225
+ specs . insert ( id, ( level, src) ) ;
265
226
}
266
227
}
267
228
@@ -275,7 +236,7 @@ impl<'s> LintLevelsBuilder<'s> {
275
236
reason,
276
237
) ;
277
238
for id in ids {
278
- self . insert_spec ( & mut specs , * id, ( level, src) ) ;
239
+ specs . insert ( * id, ( level, src) ) ;
279
240
}
280
241
}
281
242
Err ( ( Some ( ids) , new_lint_name) ) => {
@@ -312,7 +273,7 @@ impl<'s> LintLevelsBuilder<'s> {
312
273
reason,
313
274
) ;
314
275
for id in ids {
315
- self . insert_spec ( & mut specs , * id, ( level, src) ) ;
276
+ specs . insert ( * id, ( level, src) ) ;
316
277
}
317
278
}
318
279
Err ( ( None , _) ) => {
0 commit comments