Unneeded rust
as language in rustdoc
's documentation examples · Issue #13604 · rust-lang/rust-clippy (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
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; ///