@@ -59,7 +59,7 @@ use syntax::{ast, ast_util, visit};
5959mod builtin;
6060
6161#[ deriving( Clone , Show , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
62- pub enum Lint {
62+ pub enum LintId {
6363 CTypes ,
6464 UnusedImports ,
6565 UnnecessaryQualification ,
@@ -126,7 +126,7 @@ pub enum Level {
126126#[ deriving( Clone , PartialEq , PartialOrd , Eq , Ord ) ]
127127pub struct LintSpec {
128128 pub default : Level ,
129- pub lint : Lint ,
129+ pub lint : LintId ,
130130 pub desc : & ' static str ,
131131}
132132
@@ -449,7 +449,7 @@ struct Context<'a> {
449449 /// When recursing into an attributed node of the ast which modifies lint
450450 /// levels, this stack keeps track of the previous lint levels of whatever
451451 /// was modified.
452- lint_stack : Vec < ( Lint , Level , LintSource ) > ,
452+ lint_stack : Vec < ( LintId , Level , LintSource ) > ,
453453
454454 /// Id of the last visited negated expression
455455 negated_expr_id : ast:: NodeId ,
@@ -459,7 +459,7 @@ struct Context<'a> {
459459
460460 /// Level of lints for certain NodeIds, stored here because the body of
461461 /// 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 ) > ,
463463}
464464
465465pub 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,
496496 }
497497}
498498
499- pub fn lint_to_str ( lint : Lint ) -> & ' static str {
499+ pub fn lint_to_str ( lint : LintId ) -> & ' static str {
500500 for & ( name, lspec) in lint_table. iter ( ) {
501501 if lspec. lint == lint {
502502 return name;
@@ -507,29 +507,29 @@ pub fn lint_to_str(lint: Lint) -> &'static str {
507507}
508508
509509impl < ' a > Context < ' a > {
510- fn get_level ( & self , lint : Lint ) -> Level {
510+ fn get_level ( & self , lint : LintId ) -> Level {
511511 match self . cur . find ( & ( lint as uint ) ) {
512512 Some ( & ( lvl, _) ) => lvl,
513513 None => Allow
514514 }
515515 }
516516
517- fn get_source ( & self , lint : Lint ) -> LintSource {
517+ fn get_source ( & self , lint : LintId ) -> LintSource {
518518 match self . cur . find ( & ( lint as uint ) ) {
519519 Some ( & ( _, src) ) => src,
520520 None => Default
521521 }
522522 }
523523
524- fn set_level ( & mut self , lint : Lint , level : Level , src : LintSource ) {
524+ fn set_level ( & mut self , lint : LintId , level : Level , src : LintSource ) {
525525 if level == Allow {
526526 self . cur . remove ( & ( lint as uint ) ) ;
527527 } else {
528528 self . cur . insert ( lint as uint , ( level, src) ) ;
529529 }
530530 }
531531
532- fn lint_to_str ( & self , lint : Lint ) -> & ' static str {
532+ fn lint_to_str ( & self , lint : LintId ) -> & ' static str {
533533 for ( k, v) in self . dict . iter ( ) {
534534 if v. lint == lint {
535535 return * k;
@@ -538,7 +538,7 @@ impl<'a> Context<'a> {
538538 fail ! ( "unregistered lint {}" , lint) ;
539539 }
540540
541- fn span_lint ( & self , lint : Lint , span : Span , msg : & str ) {
541+ fn span_lint ( & self , lint : LintId , span : Span , msg : & str ) {
542542 let ( level, src) = match self . cur . find ( & ( lint as uint ) ) {
543543 None => { return }
544544 Some ( & ( Warn , src) ) => ( self . get_level ( Warnings ) , src) ,
0 commit comments