Show lint names

This commit is contained in:
Sangeun Kim 2013-05-08 17:23:48 +09:00
parent 356ebe8792
commit dc48a558b6
2 changed files with 9 additions and 0 deletions

View File

@ -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 {

View File

@ -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>;