Skip to content

Commit

Permalink
Move shadow_unrelated to pedantic
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Aug 14, 2018
1 parent e6d92f9 commit 7933d44
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.rs
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/shadow.rs
Expand Up @@ -71,7 +71,7 @@ declare_clippy_lint! {
/// ```
declare_clippy_lint! {
pub SHADOW_UNRELATED,
restriction,
pedantic,
"rebinding a name without even using the original value"
}

Expand Down
20 changes: 19 additions & 1 deletion tests/ui/methods.stderr
Expand Up @@ -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
|
Expand Down Expand Up @@ -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

0 comments on commit 7933d44

Please sign in to comment.