Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shadow_same is just plain wrong in an async context #7915

Closed
c410-f3r opened this issue Nov 2, 2021 · 3 comments · Fixed by #7997
Closed

shadow_same is just plain wrong in an async context #7915

c410-f3r opened this issue Nov 2, 2021 · 3 comments · Fixed by #7997
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@c410-f3r
Copy link
Contributor

c410-f3r commented Nov 2, 2021

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=bb8b58e91b2a00d51cd67875ebce1da6

Code

#![deny(clippy::shadow_same)]

pub async fn foo(_a: i32) {
}

Output

error: `_a` is shadowed by itself in `_a
@c410-f3r c410-f3r added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Nov 2, 2021
@c410-f3r
Copy link
Contributor Author

c410-f3r commented Nov 5, 2021

Is anyone willing to work on this issue? It shouldn't be too difficult to solve

@surechen
Copy link
Contributor

I am very happy to follow up on this issue.
@rustbot claim

surechen added a commit to surechen/rust-clippy that referenced this issue Nov 19, 2021
Fix shadow_same's positive false for async function's params:

Example Code:
```rust
#![deny(clippy::shadow_same)]

pub async fn foo(_a: i32) {
}
```
Output:
```
error: `_a` is shadowed by itself in `_a
```

Hir:
```rust
pub async fn foo(_a: i32)
 ->
     /*impl Trait*/ #[lang = "from_generator"](move |mut _task_context|
                                                   {
                                                       let _a = _a;
                                                       { let _t = { }; _t }
                                                   })
```

Skip checking async function's params.

changelog: Fix shadow_same's positive false for async function's params
@c410-f3r
Copy link
Contributor Author

Thank you!

bors added a commit that referenced this issue Nov 21, 2021
Fixes shadow_same's false positive for #7915

Fix shadow_same's false positive for async function's params(Fixes #7915):

Example Code:
```rust
#![deny(clippy::shadow_same)]

pub async fn foo(_a: i32) {
}
```
Output:
```
error: `_a` is shadowed by itself in `_a
```

Hir:
```rust
pub async fn foo(_a: i32)
 ->
     /*impl Trait*/ #[lang = "from_generator"](move |mut _task_context|
                                                   {
                                                       let _a = _a;
                                                       { let _t = { }; _t }
                                                   })
```

Skip checking async function's params.

changelog: Fix shadow_same's false positive for async function's params
@bors bors closed this as completed in 846c0be Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants