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

variable bindings in for loop are not linted as unused when unused #16335

Closed
huonw opened this issue Aug 7, 2014 · 2 comments
Closed

variable bindings in for loop are not linted as unused when unused #16335

huonw opened this issue Aug 7, 2014 · 2 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@huonw
Copy link
Member

huonw commented Aug 7, 2014

fn main() {
    let x = [1i];
    for mut loop_unused in x.iter() {}

    let mut normal_unused = 1i;
}

Compiling gives

<anon>:5:9: 5:26 warning: unused variable: `normal_unused`, #[warn(unused_variable)] on by default
<anon>:5     let mut normal_unused = 1i;
                 ^~~~~~~~~~~~~~~~~
<anon>:5:9: 5:26 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
<anon>:5     let mut normal_unused = 1i;
                 ^~~~~~~~~~~~~~~~~

but loop_unused should get those sort of warnings too.

(This is possibly related to #16205 in that it's probably caused by a mishandling of the for pattern.)

@huonw huonw added the A-lint label Aug 7, 2014
@ghost
Copy link

ghost commented Oct 1, 2014

Fixed in #17279, can close.

@huonw
Copy link
Member Author

huonw commented Oct 1, 2014

Thanks!

@huonw huonw closed this as completed Oct 1, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 17, 2024
internal: Compress file text using LZ4

I haven't tested properly, but this roughly looks like:

```
1246 MB
    59mb   4899 FileTextQuery

1008 MB
    20mb   4899 CompressedFileTextQuery
   555kb   1790 FileTextQuery
```

We might want to test on something more interesting, like `bevy`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

1 participant