Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show lint names #6325

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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