use std::cmp;
-use errors::DiagnosticBuilder;
+use errors::{Applicability, DiagnosticBuilder};
use hir::HirId;
use ich::StableHashingContext;
use lint::builtin;
use syntax::ast;
use syntax::attr;
use syntax::codemap::MultiSpan;
+use syntax::feature_gate;
use syntax::symbol::Symbol;
use util::nodemap::FxHashMap;
// Ensure that we never exceed the `--cap-lints` argument.
level = cmp::min(level, self.lint_cap);
+ if let Some(driver_level) = sess.driver_lint_caps.get(&LintId::of(lint)) {
+ // Ensure that we never exceed driver level.
+ level = cmp::min(*driver_level, level);
+ }
+
return (level, src)
}
continue
}
};
- let name = word.ident.name;
+ if let Some(lint_tool) = word.is_scoped() {
+ if !self.sess.features_untracked().tool_lints {
+ feature_gate::emit_feature_err(&sess.parse_sess,
+ "tool_lints",
+ word.span,
+ feature_gate::GateIssue::Language,
+ &format!("scoped lint `{}` is experimental",
+ word.ident));
+ }
+
+ if !attr::is_known_lint_tool(lint_tool) {
+ span_err!(
+ sess,
+ lint_tool.span,
+ E0710,
+ "an unknown tool name found in scoped lint: `{}`",
+ word.ident
+ );
+ }
+
+ continue
+ }
+ let name = word.name();
match store.check_lint_name(&name.as_str()) {
CheckLintNameResult::Ok(ids) => {
let src = LintSource::Node(name, li.span);
Some(li.span.into()),
&msg);
if name.as_str().chars().any(|c| c.is_uppercase()) {
- let name_lower = name.as_str().to_lowercase();
+ let name_lower = name.as_str().to_lowercase().to_string();
if let CheckLintNameResult::NoLint =
store.check_lint_name(&name_lower) {
db.emit();
} else {
- db.span_suggestion(
+ db.span_suggestion_with_applicability(
li.span,
"lowercase the lint name",
- name_lower
+ name_lower,
+ Applicability::MachineApplicable
).emit();
}
} else {