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

Maybe trait bound on type repetition #9132

Merged

Conversation

hellow554
Copy link
Contributor

@hellow554 hellow554 commented Jul 7, 2022

Please write a short comment explaining your change (or "none" for internal only changes)

changelog: fix maybe trait on [type_repetition_in_bounds] lint

I simplified the two for loops, which did exactly the same. Only downside is, that I need a copied, but that's to convert from && to &, to that should be a noop?

One more thing: I only handle TraitBoundModifier::Maybe. Can anyone give me an example (and testcase) for TraitBoundModifier::MaybeConst?

closes #8770

the two loops did practically the same, only the type were different (&&
vs &), so I used `copied` to convert `&&` and chained them together.
Instead of parsing the trait info manually, I use the already provided
method `get_trait_info_from_bound`.
Also, instead of using manual string writing, I used `join` by
`itertools`.
@rust-highfive
Copy link

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 7, 2022
@Manishearth
Copy link
Member

@bors r+

not a fan of using span arithmetic, but i don't think there's a better way here

MaybeConst is still unstable, but it looks like ~const Trait

@bors
Copy link
Collaborator

bors commented Jul 7, 2022

📌 Commit ead2c4f has been approved by Manishearth

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 7, 2022

⌛ Testing commit ead2c4f with merge 7142a59...

@bors
Copy link
Collaborator

bors commented Jul 7, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 7142a59 to master...

@bors bors merged commit 7142a59 into rust-lang:master Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

type_repetition_in_bounds makes incorrect suggestion for ?Sized bounds
4 participants