rust/tests/ui/shadow.stderr
surechen 846c0bef07 Fixes #7915
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
2021-11-21 14:28:44 +08:00

258 lines
4.8 KiB
Plaintext

error: `x` is shadowed by itself in `x`
--> $DIR/shadow.rs:5:9
|
LL | let x = x;
| ^
|
= note: `-D clippy::shadow-same` implied by `-D warnings`
note: previous binding is here
--> $DIR/shadow.rs:4:9
|
LL | let x = 1;
| ^
error: `mut x` is shadowed by itself in `&x`
--> $DIR/shadow.rs:6:13
|
LL | let mut x = &x;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:5:9
|
LL | let x = x;
| ^
error: `x` is shadowed by itself in `&mut x`
--> $DIR/shadow.rs:7:9
|
LL | let x = &mut x;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:6:9
|
LL | let mut x = &x;
| ^^^^^
error: `x` is shadowed by itself in `*x`
--> $DIR/shadow.rs:8:9
|
LL | let x = *x;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:7:9
|
LL | let x = &mut x;
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:13:9
|
LL | let x = x.0;
| ^
|
= note: `-D clippy::shadow-reuse` implied by `-D warnings`
note: previous binding is here
--> $DIR/shadow.rs:12:9
|
LL | let x = ([[0]], ());
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:14:9
|
LL | let x = x[0];
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:13:9
|
LL | let x = x.0;
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:15:10
|
LL | let [x] = x;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:14:9
|
LL | let x = x[0];
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:16:9
|
LL | let x = Some(x);
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:15:10
|
LL | let [x] = x;
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:17:9
|
LL | let x = foo(x);
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:16:9
|
LL | let x = Some(x);
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:18:9
|
LL | let x = || x;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:17:9
|
LL | let x = foo(x);
| ^
error: `x` is shadowed
--> $DIR/shadow.rs:19:9
|
LL | let x = Some(1).map(|_| x)?;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:18:9
|
LL | let x = || x;
| ^
error: `y` is shadowed
--> $DIR/shadow.rs:21:9
|
LL | let y = match y {
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:20:9
|
LL | let y = 1;
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:30:9
|
LL | let x = 2;
| ^
|
= note: `-D clippy::shadow-unrelated` implied by `-D warnings`
note: previous binding is here
--> $DIR/shadow.rs:29:9
|
LL | let x = 1;
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:35:13
|
LL | let x = 1;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:34:10
|
LL | fn f(x: u32) {
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:40:14
|
LL | Some(x) => {
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:37:9
|
LL | let x = 1;
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:41:17
|
LL | let x = 1;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:40:14
|
LL | Some(x) => {
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:45:17
|
LL | if let Some(x) = Some(1) {}
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:37:9
|
LL | let x = 1;
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:46:20
|
LL | while let Some(x) = Some(1) {}
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:37:9
|
LL | let x = 1;
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:47:15
|
LL | let _ = |[x]: [u32; 1]| {
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:37:9
|
LL | let x = 1;
| ^
error: `x` shadows a previous, unrelated binding
--> $DIR/shadow.rs:48:13
|
LL | let x = 1;
| ^
|
note: previous binding is here
--> $DIR/shadow.rs:47:15
|
LL | let _ = |[x]: [u32; 1]| {
| ^
error: `_b` shadows a previous, unrelated binding
--> $DIR/shadow.rs:85:9
|
LL | let _b = _a;
| ^^
|
note: previous binding is here
--> $DIR/shadow.rs:84:28
|
LL | pub async fn foo2(_a: i32, _b: i64) {
| ^^
error: aborting due to 21 previous errors