Skip to content

Commit 5d4c96a

Browse files
author
Keegan McAllister
committed
Rename lint::Lint to lint::LintId
1 parent 3144614 commit 5d4c96a

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/librustc/driver/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub struct Options {
7070
pub gc: bool,
7171
pub optimize: OptLevel,
7272
pub debuginfo: DebugInfoLevel,
73-
pub lint_opts: Vec<(lint::Lint, lint::Level)> ,
73+
pub lint_opts: Vec<(lint::LintId, lint::Level)> ,
7474
pub output_types: Vec<back::link::OutputType> ,
7575
// This was mutable for rustpkg, which updates search paths based on the
7676
// parsed code. It remains mutable in case its replacements wants to use

src/librustc/driver/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub struct Session {
4343
// expected to be absolute. `None` means that there is no source file.
4444
pub local_crate_source_file: Option<Path>,
4545
pub working_dir: Path,
46-
pub lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, String)>>>,
46+
pub lints: RefCell<NodeMap<Vec<(lint::LintId, codemap::Span, String)>>>,
4747
pub node_id: Cell<ast::NodeId>,
4848
pub crate_types: RefCell<Vec<config::CrateType>>,
4949
pub features: front::feature_gate::Features,
@@ -106,7 +106,7 @@ impl Session {
106106
self.diagnostic().handler().unimpl(msg)
107107
}
108108
pub fn add_lint(&self,
109-
lint: lint::Lint,
109+
lint: lint::LintId,
110110
id: ast::NodeId,
111111
sp: Span,
112112
msg: String) {

src/librustc/lint/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use syntax::{ast, ast_util, visit};
5959
mod 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)]
127127
pub 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

465465
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,
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

509509
impl<'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),

src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ pub struct ctxt {
367367

368368
pub dependency_formats: RefCell<dependency_format::Dependencies>,
369369

370-
pub node_lint_levels: RefCell<HashMap<(ast::NodeId, lint::Lint),
370+
pub node_lint_levels: RefCell<HashMap<(ast::NodeId, lint::LintId),
371371
(lint::Level, lint::LintSource)>>,
372372

373373
/// The types that must be asserted to be the same size for `transmute`

0 commit comments

Comments
 (0)