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

suggest adding space in accidental doc comments #68669

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

euclio
Copy link
Contributor

@euclio euclio commented Jan 30, 2020

Fixes #67553.

r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 30, 2020
@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 30, 2020

📌 Commit db319a8 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 30, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 30, 2020
suggest adding space in accidental doc comments

Fixes rust-lang#67553.

r? @estebank
Comment on lines +434 to +450
if let TokenKind::DocComment(..) = self.token.kind {
if let Ok(snippet) = self.span_to_snippet(self.token.span) {
let sp = self.token.span;
let marker = &snippet[..3];
let (comment_marker, doc_comment_marker) = marker.split_at(2);

e.span_suggestion(
sp.with_hi(sp.lo() + BytePos(marker.len() as u32)),
&format!(
"add a space before `{}` to use a regular comment",
doc_comment_marker,
),
format!("{} {}", comment_marker, doc_comment_marker),
Applicability::MaybeIncorrect,
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This new logic should imo be moved, including with some of the surroundings to a new method instead of having more recovery logic in the happy path.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 31, 2020
suggest adding space in accidental doc comments

Fixes rust-lang#67553.

r? @estebank
bors added a commit that referenced this pull request Jan 31, 2020
Rollup of 6 pull requests

Successful merges:

 - #68588 (check_unsafety: more code reuse)
 - #68638 (Add missing links for cmp traits)
 - #68660 (Fix typo.)
 - #68669 (suggest adding space in accidental doc comments)
 - #68670 (clarify "incorrect issue" error)
 - #68680 (Add `#![doc(html_playground_url = ...)]` to alloc crate)

Failed merges:

r? @ghost
@bors bors merged commit db319a8 into rust-lang:master Jan 31, 2020
@euclio euclio deleted the doc-comment-stmt branch January 31, 2020 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When finding an invalid outer doc comment, suggest turning it into a comment
5 participants