Merge pull request #3022 from dwijnand/move-shadow_unrelated

Move shadow_unrelated to pedantic
This commit is contained in:
Philipp Krones 2018-08-14 12:50:46 +02:00 committed by GitHub
commit 7392f6c3ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View file

@ -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,

View file

@ -71,7 +71,7 @@ declare_clippy_lint! {
/// ```
declare_clippy_lint! {
pub SHADOW_UNRELATED,
restriction,
pedantic,
"rebinding a name without even using the original value"
}

View file

@ -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