Skip to content

Commit

Permalink
Auto merge of #7827 - zvavybir:master, r=xFrednet
Browse files Browse the repository at this point in the history
Fixed naive doc formatting for `#[must_use]` lints

The documentation of a few lints around the `#[must_use]` attribute had a few times "[`#[must_use]`]" (without the parentheses, but with the `[]`) and once the "`" was missing.

changelog: Fixed naive doc formatting for `#[must_use]` lints ([`must_use_unit`], [`double_must_use`], [`must_use_candidate`], [`let_underscore_must_use`])
  • Loading branch information
bors committed Oct 16, 2021
2 parents e1871ba + 25ff7ce commit d50cfd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
12 changes: 3 additions & 9 deletions clippy_lints/src/functions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ declare_clippy_lint! {

declare_clippy_lint! {
/// ### What it does
/// Checks for a [`#[must_use]`] attribute on
/// Checks for a `#[must_use]` attribute on
/// unit-returning functions and methods.
///
/// [`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
///
/// ### Why is this bad?
/// Unit values are useless. The attribute is likely
/// a remnant of a refactoring that removed the return type.
Expand All @@ -112,12 +110,10 @@ declare_clippy_lint! {

declare_clippy_lint! {
/// ### What it does
/// Checks for a [`#[must_use]`] attribute without
/// Checks for a `#[must_use]` attribute without
/// further information on functions and methods that return a type already
/// marked as `#[must_use]`.
///
/// [`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
///
/// ### Why is this bad?
/// The attribute isn't needed. Not using the result
/// will already be reported. Alternatively, one can add some text to the
Expand All @@ -138,11 +134,9 @@ declare_clippy_lint! {
declare_clippy_lint! {
/// ### What it does
/// Checks for public functions that have no
/// [`#[must_use]`] attribute, but return something not already marked
/// `#[must_use]` attribute, but return something not already marked
/// must-use, have no mutable arg and mutate no statics.
///
/// [`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
///
/// ### Why is this bad?
/// Not bad at all, this lint just shows places where
/// you could add the attribute.
Expand Down
7 changes: 3 additions & 4 deletions clippy_lints/src/let_underscore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// ### What it does
/// Checks for `let _ = <expr>`
/// where expr is #[must_use]
/// Checks for `let _ = <expr>` where expr is `#[must_use]`
///
/// ### Why is this bad?
/// It's better to explicitly
/// handle the value of a #[must_use] expr
/// It's better to explicitly handle the value of a `#[must_use]`
/// expr
///
/// ### Example
/// ```rust
Expand Down

0 comments on commit d50cfd2

Please sign in to comment.