Skip to content

Commit 7392f6c

Browse files
authored
Merge pull request #3022 from dwijnand/move-shadow_unrelated
Move shadow_unrelated to pedantic
2 parents e6d92f9 + 7933d44 commit 7392f6c

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>) {
422422
panic_unimplemented::UNIMPLEMENTED,
423423
shadow::SHADOW_REUSE,
424424
shadow::SHADOW_SAME,
425-
shadow::SHADOW_UNRELATED,
426425
strings::STRING_ADD,
427426
write::PRINT_STDOUT,
428427
write::USE_DEBUG,
@@ -452,6 +451,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>) {
452451
needless_continue::NEEDLESS_CONTINUE,
453452
non_expressive_names::SIMILAR_NAMES,
454453
replace_consts::REPLACE_CONSTS,
454+
shadow::SHADOW_UNRELATED,
455455
strings::STRING_ADD_ASSIGN,
456456
types::CAST_POSSIBLE_TRUNCATION,
457457
types::CAST_POSSIBLE_WRAP,

clippy_lints/src/shadow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ declare_clippy_lint! {
7171
/// ```
7272
declare_clippy_lint! {
7373
pub SHADOW_UNRELATED,
74-
restriction,
74+
pedantic,
7575
"rebinding a name without even using the original value"
7676
}
7777

tests/ui/methods.stderr

+19-1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,24 @@ error: use of `unwrap_or` followed by a function call
331331
343 | let _ = stringy.unwrap_or("".to_owned());
332332
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| "".to_owned())`
333333

334+
error: `error_code` is shadowed by `123_i32`
335+
--> $DIR/methods.rs:377:9
336+
|
337+
377 | let error_code = 123_i32;
338+
| ^^^^^^^^^^
339+
|
340+
= note: `-D shadow-unrelated` implied by `-D warnings`
341+
note: initialization happens here
342+
--> $DIR/methods.rs:377:22
343+
|
344+
377 | let error_code = 123_i32;
345+
| ^^^^^^^
346+
note: previous binding is here
347+
--> $DIR/methods.rs:364:9
348+
|
349+
364 | let error_code = 123_i32;
350+
| ^^^^^^^^^^
351+
334352
error: use of `expect` followed by a function call
335353
--> $DIR/methods.rs:366:26
336354
|
@@ -435,5 +453,5 @@ error: used unwrap() on an Option value. If you don't want to handle the None ca
435453
|
436454
= note: `-D option-unwrap-used` implied by `-D warnings`
437455

438-
error: aborting due to 55 previous errors
456+
error: aborting due to 56 previous errors
439457

0 commit comments

Comments
 (0)