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

Don't add extra space before RustDoc comments #694

Conversation

sd2k
Copy link
Contributor

@sd2k sd2k commented Aug 2, 2022

In v0.11.0 the sanitize_line function was updated to add a space to
the beginning of non-empty RustDoc comments, but often those comments
already contain a space. This commit updates the check to ensure the
extra space is only added if it doesn't already exist.

Fixes #693.

@sd2k sd2k marked this pull request as draft August 2, 2022 08:24
In v0.11.0 the `sanitize_line` function was updated to add a space to
the beginning of non-empty RustDoc comments, but often those comments
already contain a space. This commit updates the check to ensure the
extra space is only added if it doesn't already exist.

We also need to check that the line doesn't start with _multiple_
spaces, as in the case of multi-line list items in Markdown docs. These
items _will_ need to be indented to match their list marker's
indentation.

Note that this commit actually modifies the `protobuf.rs` file as well
because code blocks inside RustDoc comments were previously
over-indented.

Fixes tokio-rs#693.
@sd2k sd2k force-pushed the dont-add-extra-space-before-rustdoc-comments branch from f53bae5 to c446b1f Compare August 2, 2022 08:55
@sd2k sd2k marked this pull request as ready for review August 2, 2022 09:32
Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@LucioFranco LucioFranco merged commit cab0710 into tokio-rs:master Aug 2, 2022
@sd2k sd2k deleted the dont-add-extra-space-before-rustdoc-comments branch August 2, 2022 20:15
@sd2k sd2k restored the dont-add-extra-space-before-rustdoc-comments branch August 2, 2022 20:18
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.

prost-build v0.11.0 adds an extra space before RustDoc comment text
2 participants