8000 Clippy pedantic falls over `Option<&T>` parameter of `automock`'ed function · Issue #643 · asomers/mockall · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Clippy pedantic falls over Option<&T> parameter of automock'ed function #643
Open
@jaques-sam

Description

@jaques-sam

Have for example this code:

#[automock]
pub trait Compare<T> {
    fn is_different_except_foo<'a>(&self, other: Option<&'a T>) -> bool;
}

When running clippy:

cargo clippy --release --all-targets -- -Dclippy::all -Dclippy::pedantic

This is the error popping up:

error: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
  --> configurator/src/entities/resources.rs:34:1
   |
34 | #[automock]
   | ^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
   = note: this error originates in the attribute macro `automock` (in Nightly builds, run with -Z macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0