-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Lint for redundant imports #58805
Lint for redundant imports #58805
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
if directive.parent_scope.expansion != Mark::root() {
return;
} |
With that change I get a different error:
|
@fabric-and-ink |
I updated the check. Now it seems that my test file compiles fine, without a redundancy error reported. |
By "all namespaces" I mean all namespaces in which resolution exists, i.e. if (Right now the error is not reported if the import is unresolved in any of the namespaces.) |
I updated the check. Now I get the false positive again. 😄
|
I don't see an obvious error, try to use logging to see what happens in each individual namespace. |
Have some trouble getting helpful logs. I will try a few things and will get back to you if they don't seem to work out. |
|
Strange... why don't I see these locally? |
Ok, compilation should be fine now. But I see a few errors in the |
@Mark-Simulacrum Once this is implemented wdyt about integrating into tidy? |
@Centril |
@petrochenkov Oh, we reject all warnings? That should do it then, cool. |
@Centril rust/src/bootstrap/bin/rustc.rs Lines 298 to 302 in 0547ceb
|
📌 Commit c1d5314 has been approved by |
@bors p=1 |
⌛ Testing commit c1d5314 with merge cc77f27ad5253e79b795b0c48aafba0daf0b7d96... |
…petrochenkov Lint for redundant imports Add lint for redundant imports. The changes are suggested by @petrochenkov. Closes rust-lang#10178.
@bors retry Yielding to rollup that this PR is included in. |
Rollup of 7 pull requests Successful merges: - #58805 (Lint for redundant imports) - #59506 (Use platform dependent mcount function) - #59519 (rustc_target: factor out common fields of non-Single Variants.) - #59580 (Allow closure to unsafe fn coercion) - #59581 (Stabilize refcell_replace_swap feature) - #59583 (match match match match match) - #59587 (Remove #[doc(hidden)] from Error::type_id) Failed merges: r? @ghost
@fabric-and-ink |
@petrochenkov thanks for helping me! That was fun :) I will try to contribute more often. |
Fix unused import warning. 2019-04-01 nightly introduced a new warning (presumably rust-lang/rust#58805).
Changes: ```` Remove force-host and explain no-prefer-dynamic Escape a single quote in single_char_pattern hint cargo fmt Re-add tmp feature to compiletest Remove libtest from deps Re-allow clippy::identity_conversion in compiletest Use latest compiletest-rs Revert tests/compile-test.rs to 61aa5c9 Fix ICE in suspicious_else_formatting use a multispan for MANY_SINGLE_CHAR_NAMES Add missing `// run-pass` annotations to ICE tests Remove clippy_dev as dev-dependency NFC: fix typos rustup rust-lang#59657 Add TransmutingNull Lint * Late Lint pass, catches: * One liner: 0 -> null -> transmute * One liner: std:null() -> transmute * Const (which resolves to null) -> transmute * UI Test case for Lint * Updated test for issue 3849, because now the lint that code generated is in Clippy. * Expanded `const.rs` miri-based Constant Folding code, to cover raw pointers Run rustfmt Set level of identity_conversion FP to warn Rustup to rust-lang#58805 rustup 41316f0 Updated source to match with recent rustc `master` toolchain changes Fix dogfood error of question_mark lint fix Fix question_mark lint+test use `span_lint_and_sugg` in `explicit_counter_loop` Fix some test failures Hacky rustup run cargo fmt rustup rust-lang#59096 Change explicit_counter_loop's message to add parentheses if necessary Change explicit_counter_loop's message to reflect original variable name cargo fmt Add rustfix tests for mistyped_literal_suffix lint Move some `unreadable_literal` ui tests to correct file Add implementation for the EarlyLintPass trait into the Adding Lints documentation. Add rust-toolchain for clippy_dev ````
glium reexports glutin and I think this point needs to be stressed. So using glutin from the reexport instead of the possibly available extern crate is useful at least in the examples otherwise users might not realize that they don't have to add glutin to their Cargo.toml. Therefore, the lint is silenced instead of being followed. Link to the lint change that likely caused this: rust-lang/rust#58805
Changes: ```` Remove force-host and explain no-prefer-dynamic Escape a single quote in single_char_pattern hint cargo fmt Re-add tmp feature to compiletest Remove libtest from deps Re-allow clippy::identity_conversion in compiletest Use latest compiletest-rs Revert tests/compile-test.rs to 61aa5c9 Fix ICE in suspicious_else_formatting use a multispan for MANY_SINGLE_CHAR_NAMES Add missing `// run-pass` annotations to ICE tests Remove clippy_dev as dev-dependency NFC: fix typos rustup rust-lang/rust#59657 Add TransmutingNull Lint * Late Lint pass, catches: * One liner: 0 -> null -> transmute * One liner: std:null() -> transmute * Const (which resolves to null) -> transmute * UI Test case for Lint * Updated test for issue 3849, because now the lint that code generated is in Clippy. * Expanded `const.rs` miri-based Constant Folding code, to cover raw pointers Run rustfmt Set level of identity_conversion FP to warn Rustup to rust-lang/rust#58805 rustup 41316f0 Updated source to match with recent rustc `master` toolchain changes Fix dogfood error of question_mark lint fix Fix question_mark lint+test use `span_lint_and_sugg` in `explicit_counter_loop` Fix some test failures Hacky rustup run cargo fmt rustup rust-lang/rust#59096 Change explicit_counter_loop's message to add parentheses if necessary Change explicit_counter_loop's message to reflect original variable name cargo fmt Add rustfix tests for mistyped_literal_suffix lint Move some `unreadable_literal` ui tests to correct file Add implementation for the EarlyLintPass trait into the Adding Lints documentation. Add rust-toolchain for clippy_dev ````
Add lint for redundant imports. The changes are suggested by @petrochenkov.
Closes #10178.