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

Widen understanding of prelude import #5929

Merged
merged 3 commits into from
Aug 22, 2020
Merged

Conversation

stchris
Copy link
Contributor

@stchris stchris commented Aug 20, 2020

Prelude imports are exempt from wildcard import warnings. Until now only
imports of the form

use ...::prelude::*;

were considered. This change makes it so that the segment prelude can
show up anywhere, for instance:

use ...::prelude::v1::*;

Fixes #5917

changelog: Allow prelude to appear in any segment of the import path in [wildcard_imports]

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @yaahc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 20, 2020
Copy link
Member

@ebroto ebroto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just a minor simplification

clippy_lints/src/wildcard_imports.rs Outdated Show resolved Hide resolved
@ebroto
Copy link
Member

ebroto commented Aug 20, 2020

r? @ebroto

@rust-highfive rust-highfive assigned ebroto and unassigned yaahc Aug 20, 2020
@ebroto ebroto added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 20, 2020
@stchris
Copy link
Contributor Author

stchris commented Aug 21, 2020

@ebroto I did apply your suggested change, but the build seems to break in CI on a different issue, which I can't reproduce locally, but it seems to affect other recent CI runs. I'll wait for a fix before assigning this back to you.

Edit: since the error message relates to rustc_ast, I believe that this might be the master toolchain might be broken and will likely be fixed soon.

error[E0063]: missing field `tokens` in initializer of `rustc_ast::Pat`
   --> clippy_lints/src/unnested_or_patterns.rs:339:17

@ebroto
Copy link
Member

ebroto commented Aug 21, 2020

but the build seems to break in CI on a different issue

FYI this happens every once and then, and as you saw it's not related to your PR. When rustc breaks clippy we need to sync the changes manually so that we can build against the master branch of rustc again. This may change in the near future (if we manage to pin to a nightly).

Your PR should build again after a rebase on master. Sorry for the inconvenience!

On the other hand, bors merges with master to test so this should be fine (sorry, I'm new here 😅)

@bors
Copy link
Contributor

bors commented Aug 22, 2020

📌 Commit 422c07c has been approved by ebroto

@ebroto
Copy link
Member

ebroto commented Aug 22, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Aug 22, 2020

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Aug 22, 2020

📌 Commit 422c07c has been approved by ebroto

@bors
Copy link
Contributor

bors commented Aug 22, 2020

⌛ Testing commit 422c07c with merge 57892b2...

bors added a commit that referenced this pull request Aug 22, 2020
Widen understanding of prelude import

Prelude imports are exempt from wildcard import warnings. Until now only
imports of the form

```
use ...::prelude::*;
```

were considered. This change makes it so that the segment `prelude` can
show up anywhere, for instance:

```
use ...::prelude::v1::*;
```

Fixes #5917

changelog: Allow `prelude` to appear in any segment of the import path in [`wildcard_imports`]
@bors
Copy link
Contributor

bors commented Aug 22, 2020

💔 Test failed - checks-action_test

@ebroto
Copy link
Member

ebroto commented Aug 22, 2020

It seems the rebase is necessary in this case

Prelude imports are exempt from wildcard import warnings. Until now only
imports of the form

```
use ...::prelude::*;
```

were considered. This change makes it so that the segment `prelude` can
show up anywhere, for instance:

```
use ...::prelude::v1::*;
```

Fixes rust-lang#5917
@stchris
Copy link
Contributor Author

stchris commented Aug 22, 2020

Thanks for your help, @ebroto . It's all green now :)

@ebroto
Copy link
Member

ebroto commented Aug 22, 2020

@bors retry

Thanks!

@ebroto
Copy link
Member

ebroto commented Aug 22, 2020

@bors are you still there?

@bors
Copy link
Contributor

bors commented Aug 22, 2020

🍰 Target acquired

@ebroto
Copy link
Member

ebroto commented Aug 22, 2020

@bors r=ebroto

@bors
Copy link
Contributor

bors commented Aug 22, 2020

📌 Commit e615a26 has been approved by ebroto

@bors
Copy link
Contributor

bors commented Aug 22, 2020

⌛ Testing commit e615a26 with merge f21d10b...

@bors
Copy link
Contributor

bors commented Aug 22, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: ebroto
Pushing f21d10b to master...

@bors bors merged commit f21d10b into rust-lang:master Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential false positive for wildcard_imports
5 participants