Skip to content

Show five traits implementation in help when there are exactly five - #39804

Merged
bors merged 1 commit into
rust-lang:masterfrom
seppo0010:recommend-five-traits
Feb 16, 2017
Merged

Show five traits implementation in help when there are exactly five#39804
bors merged 1 commit into
rust-lang:masterfrom
seppo0010:recommend-five-traits

Conversation

@seppo0010

Copy link
Copy Markdown
Contributor

Fixes#39802

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (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.

@eddyb

Copy link
Copy Markdown
Contributor

r? @jonathandturner

@rust-highfiverust-highfive assigned sophiajt and unassigned eddybFeb 14, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are those two backticks at the end of the line intentional?

All other tests within ui/did_you_mean/ use a separate .stderr file. I think it's not possible to use this inline error notation here.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

You are right, I copied it from src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs which has both but I did not noticed the stderr file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe you could add two more test cases (within this same file): one if there are just four implementations found and one if there are six (so that it says 'and 2 others').

@ranma42ranma42Feb 14, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a complex way to compute cmp::min(5, impl_candidates.len())
EDIT: yet it is not, if impl_candidates.len() is greater than 5, this computation returns 4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about

let end = if impl_candidates.len() <= 5{
impl_candidates.len()}else{4};

? At least for me, it would make it easier to immediately grasp the behaviour.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good idea. I've added it and squashed the commits.

@sophiajt

Copy link
Copy Markdown
Contributor

Looks good. Thanks for the PR!

@bors r+

@bors

bors commented Feb 14, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit ca54fc7 has been approved by jonathandturner

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 15, 2017
…jonathandturner
Show five traits implementation in help when there are exactly five
Fixesrust-lang#39802
@frewsxcvfrewsxcv mentioned this pull request Feb 15, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 15, 2017
…jonathandturner
Show five traits implementation in help when there are exactly five
Fixesrust-lang#39802
@frewsxcvfrewsxcv mentioned this pull request Feb 15, 2017
bors added a commit that referenced this pull request Feb 16, 2017
Rollup of 11 pull requests
- Successful merges: #39775, #39793, #39804, #39824, #39834, #39837, #39839, #39840, #39843, #39844, #39846
- Failed merges:
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 16, 2017
…jonathandturner
Show five traits implementation in help when there are exactly five
Fixesrust-lang#39802
@frewsxcvfrewsxcv mentioned this pull request Feb 16, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 16, 2017
…jonathandturner
Show five traits implementation in help when there are exactly five
Fixesrust-lang#39802
@frewsxcvfrewsxcv mentioned this pull request Feb 16, 2017
bors added a commit that referenced this pull request Feb 16, 2017
Rollup of 12 pull requests
- Successful merges: #39775, #39793, #39804, #39834, #39836, #39839, #39840, #39843, #39844, #39846, #39857, #39861
- Failed merges:
@bors
bors merged commit ca54fc7 into rust-lang:masterFeb 16, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@seppo0010@rust-highfive@eddyb@sophiajt@bors@ranma42@gralpli