-
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 have
Description
Summary
The following example identified by @Jarcho in the discussion of #16079 triggers the lint while it probably shouldn't:
#![warn(clippy::multiple_unsafe_ops_per_block)]
union U {
i: u32,
}
#[clippy::msrv = "1.91"]
fn main() {
let u = U { i: 0 };
let pu = &raw const u;
// The lint should probably not trigger here as we can't break apart the expression
unsafe {
_ = (*pu).i;
}
}Reproducer
No response
Version
Rust nightly-2025-10-31
Additional Labels
No response
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 have