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

Drawbacks

Example

/// rust /// let x = 5; ///

Could be written as:

/// /// let x = 5; ///