diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index e0ef87938f9d..0981c01892e9 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -422,7 +422,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>) { panic_unimplemented::UNIMPLEMENTED, shadow::SHADOW_REUSE, shadow::SHADOW_SAME, - shadow::SHADOW_UNRELATED, strings::STRING_ADD, write::PRINT_STDOUT, write::USE_DEBUG, @@ -452,6 +451,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>) { needless_continue::NEEDLESS_CONTINUE, non_expressive_names::SIMILAR_NAMES, replace_consts::REPLACE_CONSTS, + shadow::SHADOW_UNRELATED, strings::STRING_ADD_ASSIGN, types::CAST_POSSIBLE_TRUNCATION, types::CAST_POSSIBLE_WRAP, diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index a6645e19f02b..f04d7bf9867e 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -71,7 +71,7 @@ declare_clippy_lint! { /// ``` declare_clippy_lint! { pub SHADOW_UNRELATED, - restriction, + pedantic, "rebinding a name without even using the original value" } diff --git a/tests/ui/methods.stderr b/tests/ui/methods.stderr index a3b67bf9f6d2..bf529ce9465f 100644 --- a/tests/ui/methods.stderr +++ b/tests/ui/methods.stderr @@ -331,6 +331,24 @@ error: use of `unwrap_or` followed by a function call 343 | let _ = stringy.unwrap_or("".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())` +error: `error_code` is shadowed by `123_i32` + --> $DIR/methods.rs:377:9 + | +377 | let error_code = 123_i32; + | ^^^^^^^^^^ + | + = note: `-D shadow-unrelated` implied by `-D warnings` +note: initialization happens here + --> $DIR/methods.rs:377:22 + | +377 | let error_code = 123_i32; + | ^^^^^^^ +note: previous binding is here + --> $DIR/methods.rs:364:9 + | +364 | let error_code = 123_i32; + | ^^^^^^^^^^ + error: use of `expect` followed by a function call --> $DIR/methods.rs:366:26 | @@ -435,5 +453,5 @@ error: used unwrap() on an Option value. If you don't want to handle the None ca | = note: `-D option-unwrap-used` implied by `-D warnings` -error: aborting due to 55 previous errors +error: aborting due to 56 previous errors