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

declare that "///" is still a doc comment, just not "////+" (fixes #5838) #6680

Closed
wants to merge 1 commit into from

Conversation

ben0x539
Copy link
Contributor

There's currently a function in the lexer that rejects a line comment that is all slashes from being a doc comment. I think the intention was that you could draw boxes,

/////////////
// like so //
/////////////

Since a line doc comment split up over multiple paragraphs will have a "blank" line that is just /// between the paragraphs, that would get mistaken for a box segment, lexed as a regular comment, and go missing from the sequence of doc comment attributes before they were reassembled by rustdoc into markdown input.

I figure the best plan here is to just declare that a comment that is exactly /// is a doc comment after all, and to only omit comments with four slashes or more, which is what this commit implements. Can't really draw boxes that narrow, anyway.

@ben0x539
Copy link
Contributor Author

My backup plan would have been to lex multiple line doc comments with only non-\n spaces between them as a single token, so that interior ///-lines wouldn't ever appear on their own, but that's somewhat more complex and maybe a tad unorthodox.

This is (I think) my first non-docs non-examples non-formatting pull request, please bear with me if I'm doing it wrong. Tests still pass and it seems to work out and there's some amount of generated docs that are better formatted/have better summary vs rest of info splits, and no formatting 'regressions' that I could spot.

@brendanzab
Copy link
Member

This is good. @brson r?

bors added a commit that referenced this pull request May 24, 2013
There's currently a function in the lexer that rejects a line comment that is all slashes from being a doc comment. I think the intention was that you could draw boxes,

    /////////////
    // like so //
    /////////////

Since a line doc comment split up over multiple paragraphs will have a "blank" line that is just /// between the paragraphs, that would get mistaken for a box segment, lexed as a regular comment, and go missing from the sequence of doc comment attributes before they were reassembled by rustdoc into markdown input.

I figure the best plan here is to just declare that a comment that is exactly `///` is a doc comment after all, and to only omit comments with four slashes or more, which is what this commit implements. Can't really draw boxes that narrow, anyway.
@bors bors closed this May 24, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 11, 2021
…lip1995

Refactor: arrange transmute lints

This PR arranges `transmute` lints so that they can be accessed more easily.
Basically, I followed the instruction described in rust-lang#6680 as to how to do the refactoring.

- `declare_clippy_lint!` and `impl LintPass` is placed in `transmute/mod.rs`
- Uitlity functions is placed in `transmute/utils.rs`
- Each lint function about `transmute` is moved into its own module, like `transmute/useless_transmute.rs`

For ease of review, I refactored step by step, keeping each commit small. For instance, all I did in
2451781 was to move  `useless_transmute` into its own module.

---

changelog: Refactor `transmute.rs` file into `transmute` module.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 12, 2021
Refactor: arrange lints in `methods` module

This PR arranges methods lints so that they can be accessed more easily.
Basically, I refactored them following the instruction described in rust-lang#6680.

changelog: Move lints in methods module into their own modules.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 25, 2021
…le, r=phansch

Refactor lints in methods module

This PR refactors methods lints other than the lints I refactored in rust-lang/rust-clippy#6826 and moves some functions to methods/utils.rs.
Basically, I follow the instruction described in rust-lang#6680.

**For ease of review, I refactored step by step, keeping each commit small.**

closes rust-lang/rust-clippy#6886
cc: `@phansch,` `@flip1995,` `@Y-Nak`

changelog: Move lints in methods module to their own modules and some function to methods/utils.rs.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 8, 2021
Organize functions into functions module

Ref: rust-lang#6680
Rearrange lints in `functions`.

changelog: none
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 6, 2021
…llogiq

Refactor: arrange lints in misc_early module

This PR arranges misc_early lints so that they can be accessed more easily.
Basically, I refactored them following the instruction described in rust-lang#6680.

cc: `@Y-Nak,` `@flip1995,` `@magurotuna`

changelog: Move lints in misc_early module into their own modules.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 10, 2022
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.

5 participants