-
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-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
The borrow_as_ptr lint is emitted for borrowing a local variable as a raw pointer, but it is not emitted when the borrowed expression is a temporary literal.
Lint Name
borrow_as_ptr
Reproducer
the lint does not fire for m1, but does for m2
#[inline(never)]
pub fn m1() {
let _ptr = &42f32 as *const f32;
}
#[inline(never)]
pub fn m2() {
let tmp = 42f32;
let _ptr = &tmp as *const f32;
}https://godbolt.org/z/xoPTzr6sx
Version
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't