Unneeded rust
as language in rustdoc
's documentation examples (original) (raw)
What it does
In a documentation example, when processed by rustdoc
, it is strictly equivalent to write rust
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
, thus the equivalent lint for that may be a good idea as well. Either way, consistency is typically an improvement.
Advantage
- Less busy, and more consistent, source code.
- When contributing to a project, there is no need to remember if it is supposed to be written or not.
Drawbacks
- It may be slightly harder to copy the code into a non-
rustdoc
system.
Example
/// rust /// let x = 5; ///
Could be written as:
/// /// let x = 5; ///