-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied
Description
Summary
Reproducer attached. Clippy suggests to remove the dereference operator but without it the code doesn't compile.
Lint Name
explicit_auto_deref
Reproducer
I tried this code:
fn takes_array_ref<T, const N: usize>(array: &&[T; N]) {
takes_slice(*array) // clippy suggests to remove dereference
}
fn takes_slice<T>(slice: &[T]) {
todo!()
}
I saw this happen:
--> src/lib.rs:2:17
|
2 | takes_slice(*array)
| ^^^^^^ help: try this: `array`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
I expected to see this happen:
No lint, or a suggestion that builds
Version
rustc 1.67.0-nightly (6284998a2 2022-11-12)
binary: rustc
commit-hash: 6284998a2677d7e3e8420db783f3aa4fd80d7423
commit-date: 2022-11-12
host: aarch64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4
Additional Labels
@rustbot label +I-suggestion-causes-error
rottedfrog, Xazax-hun, CraftSpider, saschanaz, DDtKey and 4 more
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied