@@ -34,8 +34,8 @@ use driver::early_error;
34
34
use lint:: { Level , LevelSource , Lint , LintId , LintArray , LintPass , LintPassObject } ;
35
35
use lint:: { Default , CommandLine , Node , Allow , Warn , Deny , Forbid } ;
36
36
use lint:: builtin;
37
+ use util:: nodemap:: FnvHashMap ;
37
38
38
- use std:: collections:: HashMap ;
39
39
use std:: rc:: Rc ;
40
40
use std:: cell:: RefCell ;
41
41
use std:: tuple:: Tuple2 ;
@@ -63,14 +63,14 @@ pub struct LintStore {
63
63
passes : Option < Vec < LintPassObject > > ,
64
64
65
65
/// Lints indexed by name.
66
- by_name : HashMap < String , TargetLint > ,
66
+ by_name : FnvHashMap < String , TargetLint > ,
67
67
68
68
/// Current levels of each lint, and where they were set.
69
- levels : HashMap < LintId , LevelSource > ,
69
+ levels : FnvHashMap < LintId , LevelSource > ,
70
70
71
71
/// Map of registered lint groups to what lints they expand to. The bool
72
72
/// is true if the lint group was added by a plugin.
73
- lint_groups : HashMap < & ' static str , ( Vec < LintId > , bool ) > ,
73
+ lint_groups : FnvHashMap < & ' static str , ( Vec < LintId > , bool ) > ,
74
74
}
75
75
76
76
/// The targed of the `by_name` map, which accounts for renaming/deprecation.
@@ -102,9 +102,9 @@ impl LintStore {
102
102
LintStore {
103
103
lints : vec ! ( ) ,
104
104
passes : Some ( vec ! ( ) ) ,
105
- by_name : HashMap :: new ( ) ,
106
- levels : HashMap :: new ( ) ,
107
- lint_groups : HashMap :: new ( ) ,
105
+ by_name : FnvHashMap :: new ( ) ,
106
+ levels : FnvHashMap :: new ( ) ,
107
+ lint_groups : FnvHashMap :: new ( ) ,
108
108
}
109
109
}
110
110
@@ -279,7 +279,8 @@ impl LintStore {
279
279
Some ( lint_id) => self . set_level ( lint_id, ( level, CommandLine ) ) ,
280
280
None => {
281
281
match self . lint_groups . iter ( ) . map ( |( & x, pair) | ( x, pair. ref0 ( ) . clone ( ) ) )
282
- . collect :: < HashMap < & ' static str , Vec < LintId > > > ( )
282
+ . collect :: < FnvHashMap < & ' static str ,
283
+ Vec < LintId > > > ( )
283
284
. find_equiv ( lint_name. as_slice ( ) ) {
284
285
Some ( v) => {
285
286
v. iter ( )
@@ -317,7 +318,7 @@ pub struct Context<'a, 'tcx: 'a> {
317
318
318
319
/// Level of lints for certain NodeIds, stored here because the body of
319
320
/// the lint needs to run in trans.
320
- node_levels : RefCell < HashMap < ( ast:: NodeId , LintId ) , LevelSource > > ,
321
+ node_levels : RefCell < FnvHashMap < ( ast:: NodeId , LintId ) , LevelSource > > ,
321
322
}
322
323
323
324
/// Convenience macro for calling a `LintPass` method on every pass in the context.
@@ -425,7 +426,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
425
426
exported_items : exported_items,
426
427
lints : lint_store,
427
428
level_stack : vec ! [ ] ,
428
- node_levels : RefCell :: new ( HashMap :: new ( ) ) ,
429
+ node_levels : RefCell :: new ( FnvHashMap :: new ( ) ) ,
429
430
}
430
431
}
431
432
0 commit comments