-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Jan 30, 2020
euclio
force-pushed
the
doc-comment-stmt
branch
from
January 30, 2020 14:00
733146e
to
db319a8
Compare
@bors r+ |
📌 Commit db319a8 has been approved by |
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
Centril
reviewed
Jan 31, 2020
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, | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #67553.
r? @estebank