From 5d4c96a8f2c17d1d94349e0dee26a15b1aa0b5ab Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Sun, 1 Jun 2014 16:21:52 -0700 Subject: [PATCH] Rename lint::Lint to lint::LintId --- src/librustc/driver/config.rs | 2 +- src/librustc/driver/session.rs | 4 ++-- src/librustc/lint/mod.rs | 20 ++++++++++---------- src/librustc/middle/ty.rs | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index 512bdce5d88..f56e5128712 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -70,7 +70,7 @@ pub struct Options { pub gc: bool, pub optimize: OptLevel, pub debuginfo: DebugInfoLevel, - pub lint_opts: Vec<(lint::Lint, lint::Level)> , + pub lint_opts: Vec<(lint::LintId, lint::Level)> , pub output_types: Vec , // This was mutable for rustpkg, which updates search paths based on the // parsed code. It remains mutable in case its replacements wants to use diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 2978ff7f780..e84c356b2d8 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -43,7 +43,7 @@ pub struct Session { // expected to be absolute. `None` means that there is no source file. pub local_crate_source_file: Option, pub working_dir: Path, - pub lints: RefCell>>, + pub lints: RefCell>>, pub node_id: Cell, pub crate_types: RefCell>, pub features: front::feature_gate::Features, @@ -106,7 +106,7 @@ impl Session { self.diagnostic().handler().unimpl(msg) } pub fn add_lint(&self, - lint: lint::Lint, + lint: lint::LintId, id: ast::NodeId, sp: Span, msg: String) { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index e60726f6d6b..bd3b1bc7d00 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -59,7 +59,7 @@ use syntax::{ast, ast_util, visit}; mod builtin; #[deriving(Clone, Show, PartialEq, PartialOrd, Eq, Ord, Hash)] -pub enum Lint { +pub enum LintId { CTypes, UnusedImports, UnnecessaryQualification, @@ -126,7 +126,7 @@ pub enum Level { #[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct LintSpec { pub default: Level, - pub lint: Lint, + pub lint: LintId, pub desc: &'static str, } @@ -449,7 +449,7 @@ struct Context<'a> { /// When recursing into an attributed node of the ast which modifies lint /// levels, this stack keeps track of the previous lint levels of whatever /// was modified. - lint_stack: Vec<(Lint, Level, LintSource)>, + lint_stack: Vec<(LintId, Level, LintSource)>, /// Id of the last visited negated expression negated_expr_id: ast::NodeId, @@ -459,7 +459,7 @@ struct Context<'a> { /// Level of lints for certain NodeIds, stored here because the body of /// the lint needs to run in trans. - node_levels: HashMap<(ast::NodeId, Lint), (Level, LintSource)>, + node_levels: HashMap<(ast::NodeId, LintId), (Level, LintSource)>, } 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, } } -pub fn lint_to_str(lint: Lint) -> &'static str { +pub fn lint_to_str(lint: LintId) -> &'static str { for &(name, lspec) in lint_table.iter() { if lspec.lint == lint { return name; @@ -507,21 +507,21 @@ pub fn lint_to_str(lint: Lint) -> &'static str { } impl<'a> Context<'a> { - fn get_level(&self, lint: Lint) -> Level { + fn get_level(&self, lint: LintId) -> Level { match self.cur.find(&(lint as uint)) { Some(&(lvl, _)) => lvl, None => Allow } } - fn get_source(&self, lint: Lint) -> LintSource { + fn get_source(&self, lint: LintId) -> LintSource { match self.cur.find(&(lint as uint)) { Some(&(_, src)) => src, None => Default } } - fn set_level(&mut self, lint: Lint, level: Level, src: LintSource) { + fn set_level(&mut self, lint: LintId, level: Level, src: LintSource) { if level == Allow { self.cur.remove(&(lint as uint)); } else { @@ -529,7 +529,7 @@ impl<'a> Context<'a> { } } - fn lint_to_str(&self, lint: Lint) -> &'static str { + fn lint_to_str(&self, lint: LintId) -> &'static str { for (k, v) in self.dict.iter() { if v.lint == lint { return *k; @@ -538,7 +538,7 @@ impl<'a> Context<'a> { fail!("unregistered lint {}", lint); } - fn span_lint(&self, lint: Lint, span: Span, msg: &str) { + fn span_lint(&self, lint: LintId, span: Span, msg: &str) { let (level, src) = match self.cur.find(&(lint as uint)) { None => { return } Some(&(Warn, src)) => (self.get_level(Warnings), src), diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 1284992e150..97a884ae11d 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -367,7 +367,7 @@ pub struct ctxt { pub dependency_formats: RefCell, - pub node_lint_levels: RefCell>, /// The types that must be asserted to be the same size for `transmute`