Skip to content

Removes */ from block doc comments #1630

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 2 commits into from
Aug 3, 2019

Conversation

kjeremy
Copy link
Contributor

@kjeremy kjeremy commented Jul 31, 2019

The trailing / was annoying me on hover.

@kjeremy kjeremy changed the title Removes */ in block doc comments Removes */ from block doc comments Jul 31, 2019
@kjeremy
Copy link
Contributor Author

kjeremy commented Jul 31, 2019

An alternate implementation would be to provide a suffix: Option similar to the prefix but I didn't think that would buy us much. I can go down that route though if people like it better.

line[pos..].to_owned()
let end = if comment.kind().shape.is_block() && line.ends_with("*/") {
// FIXME: Use `nth_back` here once stable
if line.chars().rev().nth(2).map(|c| c.is_whitespace()).unwrap_or(false) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's check that c s is ascii as well, otherwise this will panic on weird uicode whitespace characters.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe use line[..line.len() - 2].trim_end() below instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the trim_end() on every comment line. Is there a reason we can't unconditionally do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just did that in the latest commit.

@kjeremy
Copy link
Contributor Author

kjeremy commented Aug 3, 2019

@matklad is this version good to go?

@matklad
Copy link
Member

matklad commented Aug 3, 2019

yep!

bors r+

bors bot added a commit that referenced this pull request Aug 3, 2019
1630: Removes `*/` from block doc comments r=matklad a=kjeremy

The trailing `/` was annoying me on hover.

Co-authored-by: kjeremy <[email protected]>
@bors
Copy link
Contributor

bors bot commented Aug 3, 2019

Build succeeded

@bors bors bot merged commit 0f61aa1 into rust-lang:master Aug 3, 2019
@kjeremy kjeremy deleted the remove-doc-comment-suffix branch August 3, 2019 19:38
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.

3 participants