bazelbuild / bazelbuild/rules_rust

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

Open
#1,538 1 comment 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

I'm following [these instructions](http://bazelbuild.github.io/rules_rust/rust_clippy.html) 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>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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](https://github.com/dtolnay/cxx) 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.