rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.48k stars 1.55k forks source link

Lint for spacing after comment #13709

Open pvichivanives opened 3 days ago

pvichivanives commented 3 days ago

What it does

A lint that would automatically add a space after a comment, common to many conventions and used in most example code.

Advantage

Helps code-writers not accidentally quickly type up comments and forget to add a space after their comment. This would be a nice style lint that would keep internal code documentation more uniform.

Drawbacks

Maybe should be allow by default as there are some other conventions that do not enforce this.

Could take more time to compile

Example

//Hello World

Could be written as:

// Hello World
y21 commented 1 day ago

For what it's worth, rustfmt already covers this and correctly formats it with normalize_comments = true