]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/lint/levels.rs
structured suggestion for renamed-and-removed-lints
[rust.git] / src / librustc / lint / levels.rs
index a1b84a7b716efdf4d4c9ea750bb34da9db858911..b7b6aba970bff21c76a07c1e3f7a65913a7fec5e 100644 (file)
@@ -260,19 +260,27 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
 
                     _ if !self.warn_about_weird_lints => {}
 
-                    CheckLintNameResult::Warning(ref msg) => {
+                    CheckLintNameResult::Warning(msg, renamed) => {
                         let lint = builtin::RENAMED_AND_REMOVED_LINTS;
                         let (level, src) = self.sets.get_lint_level(lint,
                                                                     self.cur,
                                                                     Some(&specs),
                                                                     &sess);
-                        lint::struct_lint_level(self.sess,
-                                                lint,
-                                                level,
-                                                src,
-                                                Some(li.span.into()),
-                                                msg)
-                            .emit();
+                        let mut err = lint::struct_lint_level(self.sess,
+                                                              lint,
+                                                              level,
+                                                              src,
+                                                              Some(li.span.into()),
+                                                              &msg);
+                        if let Some(new_name) = renamed {
+                            err.span_suggestion_with_applicability(
+                                li.span,
+                                "use the new name",
+                                new_name,
+                                Applicability::MachineApplicable
+                            );
+                        }
+                        err.emit();
                     }
                     CheckLintNameResult::NoLint => {
                         let lint = builtin::UNKNOWN_LINTS;