mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 09:03:18 +00:00
Auto merge of #7255 - whatisaphone:feat/similar-names-wparam-lparam, r=giraffate
Allow wparam and lparam in similar_names `wparam` and `lparam` are often used as generic parameter names in win32 (for example [WindowProc](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms633573(v=vs.85))). This PR adds them to the similar_names exception list. changelog: [`similar_names`] don't treat wparam and lparam as similar
This commit is contained in:
commit
41bb092185
3 changed files with 7 additions and 2 deletions
|
@ -125,6 +125,7 @@ const ALLOWED_TO_BE_SIMILAR: &[&[&str]] = &[
|
||||||
&["args", "arms"],
|
&["args", "arms"],
|
||||||
&["qpath", "path"],
|
&["qpath", "path"],
|
||||||
&["lit", "lint"],
|
&["lit", "lint"],
|
||||||
|
&["wparam", "lparam"],
|
||||||
];
|
];
|
||||||
|
|
||||||
struct SimilarNamesNameVisitor<'a, 'tcx, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
|
struct SimilarNamesNameVisitor<'a, 'tcx, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
|
||||||
|
|
|
@ -72,6 +72,10 @@ fn main() {
|
||||||
let rx1: i32;
|
let rx1: i32;
|
||||||
let tx_cake: i32;
|
let tx_cake: i32;
|
||||||
let rx_cake: i32;
|
let rx_cake: i32;
|
||||||
|
|
||||||
|
// names often used in win32 code (for example WindowProc)
|
||||||
|
let wparam: i32;
|
||||||
|
let lparam: i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo() {
|
fn foo() {
|
||||||
|
|
|
@ -92,13 +92,13 @@ LL | let parsee: i32;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: binding's name is too similar to existing binding
|
error: binding's name is too similar to existing binding
|
||||||
--> $DIR/similar_names.rs:81:16
|
--> $DIR/similar_names.rs:85:16
|
||||||
|
|
|
|
||||||
LL | bpple: sprang,
|
LL | bpple: sprang,
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
note: existing binding defined here
|
note: existing binding defined here
|
||||||
--> $DIR/similar_names.rs:80:16
|
--> $DIR/similar_names.rs:84:16
|
||||||
|
|
|
|
||||||
LL | apple: spring,
|
LL | apple: spring,
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
Loading…
Reference in a new issue