rust/compiler/rustc_lint/src
Jubilee c2bfe45e66
Rollup merge of #89473 - FabianWolff:issue-89469, r=joshtriplett
Fix extra `non_snake_case` warning for shorthand field bindings

Fixes #89469. The problem is the innermost `if` condition here:
d14731cb3c/compiler/rustc_lint/src/nonstandard_style.rs (L435-L452)

This code runs for every `PatKind::Binding`, so if a struct has multiple fields, say A and B, and both are bound in a pattern using shorthands, the call to `self.check_snake_case()` will indeed be skipped in the `check_pat()` call for `A`; but when `check_pat()` is called for `B`, the loop will still iterate over `A`, and `field.ident (= A) != ident (= B)` will be true. I have fixed this by only looking at non-shorthand bindings, and only the binding that `check_pat()` was actually called for.
2021-10-04 21:12:38 -07:00
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs Practice diagnostic message convention 2021-10-03 16:16:28 +09:00
builtin.rs Practice diagnostic message convention 2021-10-03 16:16:28 +09:00
context.rs rustc_session: Remove lint store from Session 2021-09-28 11:56:15 +03:00
early.rs Pass real crate-level attributes to pre_expansion_lint 2021-09-26 21:50:50 +00:00
internal.rs Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
late.rs Do not pass hir::Crate to lints. 2021-09-30 17:39:54 +02:00
levels.rs Rename walk_crate. 2021-09-02 19:23:11 +02:00
lib.rs Remove various unused feature gates 2021-10-02 19:09:18 +02:00
methods.rs Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
non_ascii_idents.rs Practice diagnostic message convention 2021-10-03 16:16:28 +09:00
non_fmt_panic.rs Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
nonstandard_style.rs Fix extra non_snake_case warning for shorthand field bindings 2021-10-03 14:33:14 +02:00
noop_method_call.rs review 2021-08-26 11:14:31 +02:00
passes.rs Do not pass hir::Crate to lints. 2021-09-30 17:39:54 +02:00
redundant_semicolon.rs Lint on redundant trailing semicolon after item 2020-12-29 16:30:02 -05:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs fmt 2021-09-09 05:21:30 +00:00
types.rs Auto merge of #84267 - dtolnay:ptrunit, r=nagisa 2021-10-03 00:41:49 +00:00
unused.rs Use more accurate spans for "unused delimiter" lint 2021-09-09 14:24:33 +00:00