Skip to content

Commit

Permalink
Show lint names
Browse files Browse the repository at this point in the history
  • Loading branch information
sammykim committed May 8, 2013
1 parent 356ebe8 commit dc48a55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc/driver/session.rs
Expand Up @@ -234,6 +234,7 @@ pub impl Session_ {
msg: &str) {
let level = lint::get_lint_settings_level(
self.lint_settings, lint_mode, expr_id, item_id);
let msg = fmt!("%s [-W%s]", msg, lint::get_lint_name(lint_mode));
self.span_lint_level(level, span, msg);
}
fn next_node_id(@self) -> ast::node_id {
Expand Down
8 changes: 8 additions & 0 deletions src/librustc/middle/lint.rs
Expand Up @@ -245,6 +245,14 @@ pub fn get_lint_dict() -> LintDict {
return @map;
}

pub fn get_lint_name(lint_mode: lint) -> ~str {
for lint_table.each |&(name, spec)| {
if spec.lint == lint_mode {
return name.to_str();
}
}
fail!();
}
// This is a highly not-optimal set of data structure decisions.
type LintModes = @mut SmallIntMap<level>;
type LintModeMap = @mut HashMap<ast::node_id, LintModes>;
Expand Down

0 comments on commit dc48a55

Please sign in to comment.