bazelbuild / rules_rust

Rust rules for Bazel
https://bazelbuild.github.io/rules_rust/
Apache License 2.0
667 stars 430 forks source link

Clippy #[allow(..)] does not work with clippy aspect #1538

Open rdelfin opened 2 years ago

rdelfin commented 2 years ago

I'm following these instructions to enable clippy as an aspect on my repo. In the process of doing that, I hit an issue where there was a clippy linter that I need to ignore on a line:

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
   --> wayve/robot/modules/rdma_client/client.rs:126:9
    |
126 |         unsafe fn fetch_next<'a>(self: &'a mut RemoteCameraClientBridge) -> Result<ImageData<'a>>;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

This is part of a cxx module that requires explicit parameters (following the clippy suggestion results in a compiler error). However, adding #[allow(clippy::needless_lifetimes)] be it to the line or even module where this error lies still results in clippy failing. Is aspect clippy ignorring these instructions?

UebelAndre commented 2 years ago

Can you provide a small example project to repro of the issue?