Skip to content

Clippy lints for tracing::instrument'd code gets an incorrect "unneeded return" suggestion as of 0.1.29 #3312

Open
@grahamc

Description

@grahamc

#3108 fixed some really great issues with macro'd functions. However, I noticed a function with an unneeded return statement incorrectly kept the ; in the suggestion:

error: unneeded `return` statement
  --> src/keychain.rs:97:5
   |
97 |     return Ok(());
   |     ^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `-D clippy::needless-return` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
   |
79 | #[tracing::instrument(skip(password))]
...
96 |
97 ~     Ok(());
   |

That suggestion for line 97 needs to also remove the ;.

Originally posted by @grahamc in #3108 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions