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

Possibly bad 'unused import' warning #6630

Closed
steveklabnik opened this issue May 20, 2013 · 7 comments
Closed

Possibly bad 'unused import' warning #6630

steveklabnik opened this issue May 20, 2013 · 7 comments

Comments

@steveklabnik
Copy link
Member

I get this when compiling:

/Users/steve/src/rust/src/libcore/vec.rs:25:15: 25:23 warning: unused import [-W unused-imports (default)]
/Users/steve/src/rust/src/libcore/vec.rs:25 use old_iter::{BaseIter, CopyableIter};
                                                           ^~~~~~~~

But if I remove these imports, I get an error:

/Users/steve/src/rust/src/libcore/vec.rs:329:28: 329:56 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:329                 result.push(slice(v, start, i).to_vec());
                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:334:16: 334:45 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:334     result.push(slice(v, start, ln).to_vec());
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:353:28: 353:56 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:353                 result.push(slice(v, start, i).to_vec());
                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:360:16: 360:45 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:360     result.push(slice(v, start, ln).to_vec());
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:378:28: 378:58 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:378                 result.push(slice(v, i + 1, end).to_vec());
                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:383:16: 383:43 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:383     result.push(slice(v, 0u, end).to_vec());
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:403:28: 403:59 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:403                 result.push(slice(v, i + 1u, end).to_vec());
                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/steve/src/rust/src/libcore/vec.rs:410:16: 410:43 error: type `&['a]` does not implement any method in scope named `to_vec`
/Users/steve/src/rust/src/libcore/vec.rs:410     result.push(slice(v, 0u, end).to_vec());

I'm not sure if this is a problem in the warning check, or what, but figured I'd raise the issue.

@alexcrichton
Copy link
Member

I'll take a look at this, is this on the current incoming? If you've got a specific revision, that'd be awesome!

I know that without prelude injection things get weird, and I was never quite sure why...

@steveklabnik
Copy link
Member Author

Yes, on the current incoming, and with incoming + all my 'remove warnings' PRs that bors is building.

@steveklabnik
Copy link
Member Author

Oh, I should mention that this happens in stage2:

cp: x86_64-apple-darwin/stage2/lib/librust.dylib
cp: x86_64-apple-darwin/stage2/bin/rust
compile_and_link: x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libcore.dylib
/Users/steve/src/rust/src/libcore/vec.rs:25:15: 25:23 warning: unused import [-W unused-imports (default)]
/Users/steve/src/rust/src/libcore/vec.rs:25 use old_iter::{BaseIter, CopyableIter};
                                                           ^~~~~~~~

@alexcrichton
Copy link
Member

This is probably just a stage0 thing where resolve changed. Try doing #[cfg(stage0)] front of including BaseIter, and it should compile (I can verify later if you're unable to, I can't right now)

@steveklabnik
Copy link
Member Author

Is that a good idea, or is it the kind of thing where the next snapshot will make it go away?

@alexcrichton
Copy link
Member

I just looked into this, and I think that you were removing the entire import. Just the BaseIter import needed to be removed, not the CopyableIter

@alexcrichton
Copy link
Member

This was removed in #6648

flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 30, 2021
…ion, r=llogiq

Documentation for adding configuration to a lint and common abbreviations

This PR adds some commonly used abbreviations to the `basis.md` file and a guide on how to implement a configuration value for a lint.

* [Rendered `/doc/basics.md` (Abbreviation list)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/basics.md#common-abbreviations)
* [Rendered `/doc/adding_lints.md` (Configuration value guide)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/adding_lints.md#adding-configuration-to-a-lint)

I'm not sure if the guide is written in the best way. Style suggestions are appreciated. 🙃

 ---

Again a big **thank you** for everyone who helped to collect the abbreviation list over on [zulip]. I had a lot of fun, and it was also very informative. Keep up the good work 🙃

[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Common.20abbreviations.20in.20basics.2Emd/near/223548065
---

changelog: none
bors pushed a commit to rust-lang-ci/rust that referenced this issue Feb 3, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 3, 2021
…ion-some-nits, r=flip1995

Updated some NITs in the documentation from rust-lang#6630

I've implemented the two suggestions from rust-lang#6630 that were added after the merge. This PR also changes the example code to use `register_*_pass` instead of `register_late_pass`. I'm not sure if this is better or worse, but it makes it clearer in my opinion. Let me know if I should change it back.

---

changelog: none

r? `@flip1995`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants