rust-clippy/tests/ui/borrow_as_ptr.rs
Marcin Serwin a3baebcb31
Add ref_as_ptr lint
Author:    Marcin Serwin <marcin.serwin0@protonmail.com>
2024-02-04 17:38:09 +01:00

19 lines
375 B
Rust

#![warn(clippy::borrow_as_ptr)]
#![allow(clippy::useless_vec)]
fn a() -> i32 {
0
}
#[clippy::msrv = "1.75"]
fn main() {
let val = 1;
let _p = &val as *const i32;
let _p = &0 as *const i32;
let _p = &a() as *const i32;
let vec = vec![1];
let _p = &vec.len() as *const usize;
let mut val_mut = 1;
let _p_mut = &mut val_mut as *mut i32;
}