- if let Some(ids) = result {
- let complete_name = &format!("{}::{}", tool_name.unwrap(), name);
- let src = LintSource::Node(Symbol::intern(complete_name), li.span);
- for id in ids {
- specs.insert(*id, (level, src));
+ match result {
+ Ok(ids) => {
+ let complete_name = &format!("{}::{}", tool_name.unwrap(), name);
+ let src = LintSource::Node(Symbol::intern(complete_name), li.span);
+ for id in ids {
+ specs.insert(*id, (level, src));
+ }
+ }
+ Err((Some(ids), new_lint_name)) => {
+ let lint = builtin::RENAMED_AND_REMOVED_LINTS;
+ let (lvl, src) =
+ self.sets
+ .get_lint_level(lint, self.cur, Some(&specs), &sess);
+ let mut err = lint::struct_lint_level(
+ self.sess,
+ lint,
+ lvl,
+ src,
+ Some(li.span.into()),
+ &format!(
+ "lint name `{}` is deprecated \
+ and may not have an effect in the future",
+ name
+ ),
+ );
+ err.span_suggestion_with_applicability(
+ li.span,
+ "change it to",
+ new_lint_name.to_string(),
+ Applicability::MachineApplicable,
+ );
+ err.emit();
+ let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
+ for id in ids {
+ specs.insert(*id, (level, src));
+ }
+ }
+ Err((None, _)) => {
+ // If Tool(Err(None, _)) is returned, then either the lint does not
+ // exist in the tool or the code was not compiled with the tool and
+ // therefore the lint was never added to the `LintStore`. To detect
+ // this is the responsibility of the lint tool.