]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/shadow.stderr
Rewrite shadow lint
[rust.git] / tests / ui / shadow.stderr
index 196f17ac65393e57c1bb68bf07d5a8612f28a5e6..8b60e072c9342c9c763dc6b8de1740cef3f99dac 100644 (file)
-error: `x` is shadowed by itself in `&mut x`
-  --> $DIR/shadow.rs:29:5
+error: `x` is shadowed by itself in `x`
+  --> $DIR/shadow.rs:5:9
    |
-29 |     let x = &mut x;
-   |     ^^^^^^^^^^^^^^^
+LL |     let x = x;
+   |         ^
    |
    = note: `-D clippy::shadow-same` implied by `-D warnings`
 note: previous binding is here
-  --> $DIR/shadow.rs:28:13
+  --> $DIR/shadow.rs:4:9
    |
-28 |     let mut x = 1;
-   |             ^
+LL |     let x = 1;
+   |         ^
 
-error: `x` is shadowed by itself in `{ x }`
-  --> $DIR/shadow.rs:30:5
+error: `mut x` is shadowed by itself in `&x`
+  --> $DIR/shadow.rs:6:13
    |
-30 |     let x = { x };
-   |     ^^^^^^^^^^^^^^
+LL |     let mut x = &x;
+   |             ^
    |
 note: previous binding is here
-  --> $DIR/shadow.rs:29:9
+  --> $DIR/shadow.rs:5:9
+   |
+LL |     let x = x;
+   |         ^
+
+error: `x` is shadowed by itself in `&mut x`
+  --> $DIR/shadow.rs:7:9
    |
-29 |     let x = &mut x;
+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:31:5
+error: `x` is shadowed by itself in `*x`
+  --> $DIR/shadow.rs:8:9
    |
-31 |     let x = (&*x);
-   |     ^^^^^^^^^^^^^^
+LL |     let x = *x;
+   |         ^
    |
 note: previous binding is here
-  --> $DIR/shadow.rs:30:9
+  --> $DIR/shadow.rs:7:9
    |
-30 |     let x = { x };
+LL |     let x = &mut x;
    |         ^
 
-error: `x` is shadowed by `{ *x + 1 }` which reuses the original value
-  --> $DIR/shadow.rs:32:9
+error: `x` is shadowed by `x.0` which reuses the original value
+  --> $DIR/shadow.rs:13:9
    |
-32 |     let x = { *x + 1 };
+LL |     let x = x.0;
    |         ^
    |
    = note: `-D clippy::shadow-reuse` implied by `-D warnings`
-note: initialization happens here
-  --> $DIR/shadow.rs:32:13
-   |
-32 |     let x = { *x + 1 };
-   |             ^^^^^^^^^^
 note: previous binding is here
-  --> $DIR/shadow.rs:31:9
+  --> $DIR/shadow.rs:12:9
    |
-31 |     let x = (&*x);
+LL |     let x = ([[0]], ());
    |         ^
 
-error: `x` is shadowed by `id(x)` which reuses the original value
-  --> $DIR/shadow.rs:33:9
+error: `x` is shadowed by `x[0]` which reuses the original value
+  --> $DIR/shadow.rs:14:9
    |
-33 |     let x = id(x);
+LL |     let x = x[0];
    |         ^
    |
-note: initialization happens here
-  --> $DIR/shadow.rs:33:13
+note: previous binding is here
+  --> $DIR/shadow.rs:13:9
+   |
+LL |     let x = x.0;
+   |         ^
+
+error: `x` is shadowed by `x` which reuses the original value
+  --> $DIR/shadow.rs:15:10
+   |
+LL |     let [x] = x;
+   |          ^
    |
-33 |     let x = id(x);
-   |             ^^^^^
 note: previous binding is here
-  --> $DIR/shadow.rs:32:9
+  --> $DIR/shadow.rs:14:9
    |
-32 |     let x = { *x + 1 };
+LL |     let x = x[0];
    |         ^
 
-error: `x` is shadowed by `(1, x)` which reuses the original value
-  --> $DIR/shadow.rs:34:9
+error: `x` is shadowed by `Some(x)` which reuses the original value
+  --> $DIR/shadow.rs:16:9
    |
-34 |     let x = (1, x);
+LL |     let x = Some(x);
    |         ^
    |
-note: initialization happens here
-  --> $DIR/shadow.rs:34:13
+note: previous binding is here
+  --> $DIR/shadow.rs:15:10
+   |
+LL |     let [x] = x;
+   |          ^
+
+error: `x` is shadowed by `foo(x)` which reuses the original value
+  --> $DIR/shadow.rs:17:9
+   |
+LL |     let x = foo(x);
+   |         ^
    |
-34 |     let x = (1, x);
-   |             ^^^^^^
 note: previous binding is here
-  --> $DIR/shadow.rs:33:9
+  --> $DIR/shadow.rs:16:9
    |
-33 |     let x = id(x);
+LL |     let x = Some(x);
    |         ^
 
-error: `x` is shadowed by `first(x)` which reuses the original value
-  --> $DIR/shadow.rs:35:9
+error: `x` is shadowed by `|| x` which reuses the original value
+  --> $DIR/shadow.rs:18:9
    |
-35 |     let x = first(x);
+LL |     let x = || x;
    |         ^
    |
-note: initialization happens here
-  --> $DIR/shadow.rs:35:13
+note: previous binding is here
+  --> $DIR/shadow.rs:17:9
+   |
+LL |     let x = foo(x);
+   |         ^
+
+error: `x` is shadowed by `Some(1).map(|_| x)?` which reuses the original value
+  --> $DIR/shadow.rs:19:9
+   |
+LL |     let x = Some(1).map(|_| x)?;
+   |         ^
    |
-35 |     let x = first(x);
-   |             ^^^^^^^^
 note: previous binding is here
-  --> $DIR/shadow.rs:34:9
+  --> $DIR/shadow.rs:18:9
    |
-34 |     let x = (1, x);
+LL |     let x = || x;
    |         ^
 
-error: `x` is shadowed by `y`
-  --> $DIR/shadow.rs:37:9
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:25:9
    |
-37 |     let x = y;
+LL |     let x = 2;
    |         ^
    |
    = note: `-D clippy::shadow-unrelated` implied by `-D warnings`
-note: initialization happens here
-  --> $DIR/shadow.rs:37:13
+note: previous binding is here
+  --> $DIR/shadow.rs:24:9
    |
-37 |     let x = y;
+LL |     let x = 1;
+   |         ^
+
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:30:13
+   |
+LL |         let x = 1;
    |             ^
+   |
+note: previous binding is here
+  --> $DIR/shadow.rs:29:10
+   |
+LL |     fn f(x: u32) {
+   |          ^
+
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:35:14
+   |
+LL |         Some(x) => {
+   |              ^
+   |
+note: previous binding is here
+  --> $DIR/shadow.rs:32:9
+   |
+LL |     let x = 1;
+   |         ^
+
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:36:17
+   |
+LL |             let x = 1;
+   |                 ^
+   |
+note: previous binding is here
+  --> $DIR/shadow.rs:35:14
+   |
+LL |         Some(x) => {
+   |              ^
+
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:40:17
+   |
+LL |     if let Some(x) = Some(1) {}
+   |                 ^
+   |
 note: previous binding is here
-  --> $DIR/shadow.rs:35:9
+  --> $DIR/shadow.rs:32:9
    |
-35 |     let x = first(x);
+LL |     let x = 1;
    |         ^
 
-error: `x` shadows a previous declaration
-  --> $DIR/shadow.rs:39:5
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:41:20
    |
-39 |     let x;
-   |     ^^^^^^
+LL |     while let Some(x) = Some(1) {}
+   |                    ^
    |
 note: previous binding is here
-  --> $DIR/shadow.rs:37:9
+  --> $DIR/shadow.rs:32:9
    |
-37 |     let x = y;
+LL |     let x = 1;
    |         ^
 
-error: aborting due to 9 previous errors
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:42:15
+   |
+LL |     let _ = |[x]: [u32; 1]| {
+   |               ^
+   |
+note: previous binding is here
+  --> $DIR/shadow.rs:32:9
+   |
+LL |     let x = 1;
+   |         ^
+
+error: `x` shadows a previous, unrelated binding
+  --> $DIR/shadow.rs:43:13
+   |
+LL |         let x = 1;
+   |             ^
+   |
+note: previous binding is here
+  --> $DIR/shadow.rs:42:15
+   |
+LL |     let _ = |[x]: [u32; 1]| {
+   |               ^
+
+error: aborting due to 19 previous errors