Open ojeda opened 4 weeks ago
Should this be a part of clippy
? This seems like a better fit for a rustdoc warning, as it has all the markdown parsing code already.
Yeah, that may be right, I wasn't sure where to place it (there are other doc-related lints in Clippy already and perhaps rustdoc
treats "stylistic diagnostics" like rustc
, i.e. leaves those up to Clippy and other tools).
Cc @GuillaumeGomez
I think it's actually a better idea to put it into clippy as a style lint because it's completely ok to add rust
marker on a codeblock, even if useless in most cases.
What it does
In a documentation example, when processed by
rustdoc
, it is strictly equivalent to writerust
or not (https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html).Thus it would be nice to have a lint that suggest the removal of the unneeded
rust
as language for the example.Some projects may prefer the opposite, i.e. always writing
rust
, but consistency is typically an improvement.Advantage
Drawbacks
rustdoc
system.Example
Could be written as: