@@ -59,7 +59,7 @@ use syntax::{ast, ast_util, visit};
59
59
mod builtin;
60
60
61
61
#[ deriving( Clone , Show , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
62
- pub enum Lint {
62
+ pub enum LintId {
63
63
CTypes ,
64
64
UnusedImports ,
65
65
UnnecessaryQualification ,
@@ -126,7 +126,7 @@ pub enum Level {
126
126
#[ deriving( Clone , PartialEq , PartialOrd , Eq , Ord ) ]
127
127
pub struct LintSpec {
128
128
pub default : Level ,
129
- pub lint : Lint ,
129
+ pub lint : LintId ,
130
130
pub desc : & ' static str ,
131
131
}
132
132
@@ -449,7 +449,7 @@ struct Context<'a> {
449
449
/// When recursing into an attributed node of the ast which modifies lint
450
450
/// levels, this stack keeps track of the previous lint levels of whatever
451
451
/// was modified.
452
- lint_stack : Vec < ( Lint , Level , LintSource ) > ,
452
+ lint_stack : Vec < ( LintId , Level , LintSource ) > ,
453
453
454
454
/// Id of the last visited negated expression
455
455
negated_expr_id : ast:: NodeId ,
@@ -459,7 +459,7 @@ struct Context<'a> {
459
459
460
460
/// Level of lints for certain NodeIds, stored here because the body of
461
461
/// the lint needs to run in trans.
462
- node_levels : HashMap < ( ast:: NodeId , Lint ) , ( Level , LintSource ) > ,
462
+ node_levels : HashMap < ( ast:: NodeId , LintId ) , ( Level , LintSource ) > ,
463
463
}
464
464
465
465
pub fn emit_lint ( level : Level , src : LintSource , msg : & str , span : Span ,
@@ -496,7 +496,7 @@ pub fn emit_lint(level: Level, src: LintSource, msg: &str, span: Span,
496
496
}
497
497
}
498
498
499
- pub fn lint_to_str ( lint : Lint ) -> & ' static str {
499
+ pub fn lint_to_str ( lint : LintId ) -> & ' static str {
500
500
for & ( name, lspec) in lint_table. iter ( ) {
501
501
if lspec. lint == lint {
502
502
return name;
@@ -507,29 +507,29 @@ pub fn lint_to_str(lint: Lint) -> &'static str {
507
507
}
508
508
509
509
impl < ' a > Context < ' a > {
510
- fn get_level ( & self , lint : Lint ) -> Level {
510
+ fn get_level ( & self , lint : LintId ) -> Level {
511
511
match self . cur . find ( & ( lint as uint ) ) {
512
512
Some ( & ( lvl, _) ) => lvl,
513
513
None => Allow
514
514
}
515
515
}
516
516
517
- fn get_source ( & self , lint : Lint ) -> LintSource {
517
+ fn get_source ( & self , lint : LintId ) -> LintSource {
518
518
match self . cur . find ( & ( lint as uint ) ) {
519
519
Some ( & ( _, src) ) => src,
520
520
None => Default
521
521
}
522
522
}
523
523
524
- fn set_level ( & mut self , lint : Lint , level : Level , src : LintSource ) {
524
+ fn set_level ( & mut self , lint : LintId , level : Level , src : LintSource ) {
525
525
if level == Allow {
526
526
self . cur . remove ( & ( lint as uint ) ) ;
527
527
} else {
528
528
self . cur . insert ( lint as uint , ( level, src) ) ;
529
529
}
530
530
}
531
531
532
- fn lint_to_str ( & self , lint : Lint ) -> & ' static str {
532
+ fn lint_to_str ( & self , lint : LintId ) -> & ' static str {
533
533
for ( k, v) in self . dict . iter ( ) {
534
534
if v. lint == lint {
535
535
return * k;
@@ -538,7 +538,7 @@ impl<'a> Context<'a> {
538
538
fail ! ( "unregistered lint {}" , lint) ;
539
539
}
540
540
541
- fn span_lint ( & self , lint : Lint , span : Span , msg : & str ) {
541
+ fn span_lint ( & self , lint : LintId , span : Span , msg : & str ) {
542
542
let ( level, src) = match self . cur . find ( & ( lint as uint ) ) {
543
543
None => { return }
544
544
Some ( & ( Warn , src) ) => ( self . get_level ( Warnings ) , src) ,
0 commit comments