Skip to content

rustdoc: render 1-tuples as (T,) instead of (T) #15614

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

Merged
merged 1 commit into from
Jul 13, 2014
Merged

Conversation

lucidd
Copy link
Contributor

@lucidd lucidd commented Jul 11, 2014

This fixes #15474

format!("({:#})", typs).as_slice())
match typs.as_slice() {
[ref one] => format!("({},)", one),
[..many] => format!("({:#})", many)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this use {:#}? The documentation claims that the # flag only applies to integral formatting.

Also, [..many] is unnecessary, you can just say many.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah hah, the documentation is wrong. # on slices omits the brackets. That really should be documented.

@lilyball
Copy link
Contributor

r=me if you tweak the [..many] pattern as suggested. Well, r=me even if you don't, but I'd prefer it if you made that change first.

@lucidd
Copy link
Contributor Author

lucidd commented Jul 11, 2014

@kballard thanks for the feedback. You are right the [..many] is unnecessary i will change that first.

@lilyball
Copy link
Contributor

It occurs to me that I have no idea if rustdoc has an infrastructure for testing this sort of thing. If it does, it would be a good idea to add a test.

@lucidd
Copy link
Contributor Author

lucidd commented Jul 11, 2014

@kballard i couldn't find any tests related to that. Do you think this kind of test should be added?

@alexcrichton
Copy link
Member

Sadly we don't have a whole lot of tests for rustdoc right now, it's ok to add this without a test.

bors added a commit that referenced this pull request Jul 13, 2014
@bors bors closed this Jul 13, 2014
@bors bors merged commit 3d2fd5e into rust-lang:master Jul 13, 2014
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

Successfully merging this pull request may close these issues.

rustdoc should render 1-tuples as (T,)
4 participants