Closed
Description
Summary
We have this function in our crate https://github.com/AFLplusplus/LibAFL/tree/main/libafl
https://github.com/AFLplusplus/LibAFL/blob/main/libafl/src/observers/mod.rs#L816
#[pyo3(name = "match_name")]
#[allow(clippy::all)]
fn pymatch_name(&self, name: &str) -> Option<PythonObserver> {
for ob in &self.list {
if *ob.name() == *name {
return Some(ob.clone());
}
}
None
}
and clippy gives this warning
error: deref on an immutable reference
--> libafl/src/observers/mod.rs:817:38
|
817 | fn pymatch_name(&self, name: &str) -> Option<PythonObserver> {
| ^^^^ help: if you would like to reborrow, try removing `&*`: `&str`
|
note: the lint level is defined here
--> libafl/src/lib.rs:14:9
|
14 | #![deny(clippy::all)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::borrow_deref_ref)]` implied by `#[deny(clippy::all)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
We actually have allow(clippy::all) on this function, but still the clippy gives this error and it's not ignored.
Lint Name
borrow_deref_ref
Reproducer
You can clone the repo https://github.com/AFLplusplus/LibAFL/tree/main/libafl
and checkout to debug_restarting branch
and run
RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --release --tests -- -Z macro-backtrace -D clippy::all -D clippy::pedantic -W clippy::similar_names -A clippy::type_repetition_in_bounds -A clippy::missing-errors-doc -A clippy::cast-possible-truncation -A clippy::used-underscore-binding -A clippy::ptr-as-ptr -A clippy::missing-panics-doc -A clippy::missing-docs-in-private-items -A clippy::unseparated-literal-suffix -A clippy::module-name-repetitions -A clippy::unreadable-literal
or simply
./script/clippy.sh
Version
rustc 1.63.0-nightly (5435ed691 2022-06-07)
binary: rustc
commit-hash: 5435ed6916a59e8d5acba2149316a841c3905cbd
commit-date: 2022-06-07
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.5
Additional Labels
No response