Skip to content

rustdoc: Cleanup associated const value rendering - #42286

Merged
bors merged 1 commit into
rust-lang:masterfrom
ollie27:rustdoc_assoc_const
Jun 1, 2017
Merged

rustdoc: Cleanup associated const value rendering#42286
bors merged 1 commit into
rust-lang:masterfrom
ollie27:rustdoc_assoc_const

Conversation

@ollie27

@ollie27ollie27 commented May 28, 2017

Copy link
Copy Markdown
Contributor

Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.

Also cleans up adding parens around references to trait objects.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @steveklabnik

(rust_highfive has picked a reviewer for you, use r? to override)

@frewsxcvfrewsxcv added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label May 29, 2017
@carols10centscarols10cents added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 29, 2017
} else {
root.push_str(&seg.name);
root.push_str("/");
if is_not_debug {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm pretty surprised that we have the same outcome in 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.

With w.alternate() == true it does write!(w, "{}::", seg.name)?;, as can be seen above. The is_not_debug == false case did exactly the same thing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh I see!

} else {
write!(f, "{:#}::", self_type)?
}
if should_show_cast {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Once again I'm surprised the code does the same thing.

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.

The is_not_debug == false case was:

if should_show_cast {write!(f,"<{:?} as {:?}>::", self_type, trait_)?
}else{write!(f,"{:?}::", self_type)?
}

The f.alternate() == true case is:

if should_show_cast {write!(f,"<{:#} as {:#}>::", self_type, trait_)?
}else{write!(f,"{:#}::", self_type)?
}

@GuillaumeGomez

Copy link
Copy Markdown
Member

Just waiting for some other people to review as well to confirm I didn't miss anything.

cc @rust-lang/dev-tools

@steveklabnik

Copy link
Copy Markdown
Contributor

@bors: r+

thanks so much!

@bors

bors commented May 30, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit ef9b2e8 has been approved by steveklabnik

@bors

bors commented May 31, 2017

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #42318) made this pull request unmergeable. Please resolve the merge conflicts.

@ollie27
ollie27force-pushed the rustdoc_assoc_const branch from ef9b2e8 to 6df7535CompareMay 31, 2017 17:15
@ollie27

Copy link
Copy Markdown
ContributorAuthor

I've rebased and redone #42318.

Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.
Also cleans up adding parens around references to trait objects.
@ollie27
ollie27force-pushed the rustdoc_assoc_const branch from 6df7535 to 86ea93eCompareMay 31, 2017 19:06
} else {
write!(f, "&amp;{}{}", lt, m)?;
}
write!(f, "(")?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh I see. Better indeed!

@GuillaumeGomez

Copy link
Copy Markdown
Member

Thanks for the update and the improvement!

@bors: r+

@bors

bors commented May 31, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 86ea93e has been approved by GuillaumeGomez

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 1, 2017
…laumeGomez
rustdoc: Cleanup associated const value rendering
Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.
Also cleans up adding parens around references to trait objects.
@frewsxcvfrewsxcv mentioned this pull request Jun 1, 2017
@frewsxcvfrewsxcv mentioned this pull request Jun 1, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 1, 2017
…laumeGomez
rustdoc: Cleanup associated const value rendering
Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.
Also cleans up adding parens around references to trait objects.
@frewsxcvfrewsxcv mentioned this pull request Jun 1, 2017
bors added a commit that referenced this pull request Jun 1, 2017
Rollup of 9 pull requests
- Successful merges: #42136, #42275, #42286, #42297, #42302, #42306, #42314, #42324, #42347
- Failed merges:
@bors
bors merged commit 86ea93e into rust-lang:masterJun 1, 2017
@ollie27
ollie27 deleted the rustdoc_assoc_const branch June 1, 2017 08:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@ollie27@rust-highfive@GuillaumeGomez@steveklabnik@bors@oli-obk@carols10cents@frewsxcv