Skip to content

Handle #[expect] in automock #614

Closed
@Rosdf

Description

@Rosdf
#[mockall::automock]
pub trait MyTrait {
    #[expect(
        clippy::needless_lifetimes,
        single_use_lifetimes,
        reason = "required for mocking"
    )]
    fn get<'a>(
        &mut self,
        string: &'a str,
    ) -> String;
}

clippy produces warnings

warning: this lint expectation is unfulfilled
 --> src/main.rs:8:9
  |
8 |         clippy::needless_lifetimes,
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: required for mocking
  = note: `#[warn(unfulfilled_lint_expectations)]` on by default

warning: this lint expectation is unfulfilled
 --> src/main.rs:9:9
  |
9 |         single_use_lifetimes,
  |         ^^^^^^^^^^^^^^^^^^^^
  |
  = note: required for mocking

without #[mockall::automock] no warnings produced

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions