auto merge of #6325 : sammykim/rust/lint-name, r=graydon

Fix #3525.
This commit is contained in:
bors 2013-05-09 08:54:38 -07:00
commit 7a4c6e587d
2 changed files with 9 additions and 0 deletions

View File

@ -237,6 +237,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 {

View File

@ -237,6 +237,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>;