From 798a20740ea0435727ae784a62f1632d45628dce Mon Sep 17 00:00:00 2001 From: flip1995 <9744647+flip1995@users.noreply.github.com> Date: Sat, 1 Sep 2018 17:43:14 +0200 Subject: [PATCH 1/3] Fix of bug introduced by #53762 --- src/librustc/lint/context.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index d5247b4ce9de8..ddd74813621a8 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -319,7 +319,15 @@ impl LintStore { CheckLintNameResult::NoLint => { Some(struct_err!(sess, E0602, "unknown lint: `{}`", lint_name)) } - CheckLintNameResult::Tool(_) => unreachable!(), + CheckLintNameResult::Tool(result) => match result { + Err((Some(_), new_name)) => Some(sess.struct_warn(&format!( + "lint name `{}` is deprcated \ + and does not have an effect anymore. \ + Use: {}", + lint_name, new_name + ))), + _ => None, + }, }; if let Some(mut db) = db { From 6a317be5c89febbdef799155e8cf667a93fa88d5 Mon Sep 17 00:00:00 2001 From: flip1995 <9744647+flip1995@users.noreply.github.com> Date: Sat, 1 Sep 2018 18:06:36 +0200 Subject: [PATCH 2/3] Add tests for cmdline tool lints --- .../ui-fulldeps/lint_tool_cmdline_allow.rs | 23 +++++++++++++++++ .../lint_tool_cmdline_allow.stderr | 25 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/test/ui-fulldeps/lint_tool_cmdline_allow.rs create mode 100644 src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs b/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs new file mode 100644 index 0000000000000..74888d3e14004 --- /dev/null +++ b/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs @@ -0,0 +1,23 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:lint_tool_test.rs +// ignore-stage1 +// compile-flags: -A test-lint + +#![feature(plugin)] +#![warn(unused)] +#![plugin(lint_tool_test)] + +fn lintme() { } + +pub fn main() { +} diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr new file mode 100644 index 0000000000000..fbf28a68bd0cc --- /dev/null +++ b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr @@ -0,0 +1,25 @@ +warning: lint name `test_lint` is deprcated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: item is named 'lintme' + --> $DIR/lint_tool_cmdline_allow.rs:20:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: #[warn(clippy::test_lint)] on by default + +warning: function is never used: `lintme` + --> $DIR/lint_tool_cmdline_allow.rs:20:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint_tool_cmdline_allow.rs:17:9 + | +LL | #![warn(unused)] + | ^^^^^^ + = note: #[warn(dead_code)] implied by #[warn(unused)] + From daa43643b06bf89a183ee9a41d8e50fa80f62c23 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 1 Sep 2018 21:45:44 +0530 Subject: [PATCH 3/3] deprcated -> deprecated --- src/librustc/lint/context.rs | 2 +- src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index ddd74813621a8..b823545aa9114 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -321,7 +321,7 @@ impl LintStore { } CheckLintNameResult::Tool(result) => match result { Err((Some(_), new_name)) => Some(sess.struct_warn(&format!( - "lint name `{}` is deprcated \ + "lint name `{}` is deprecated \ and does not have an effect anymore. \ Use: {}", lint_name, new_name diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr index fbf28a68bd0cc..c1a9d81874671 100644 --- a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr +++ b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr @@ -1,4 +1,4 @@ -warning: lint name `test_lint` is deprcated and does not have an effect anymore. Use: clippy::test_lint +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint | = note: requested on the command line with `-A test_lint`