mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
a3baebcb31
Author: Marcin Serwin <marcin.serwin0@protonmail.com>
269 lines
8.8 KiB
Text
269 lines
8.8 KiB
Text
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:5:13
|
|
|
|
|
LL | let _ = &1u8 as *const _;
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&1u8)`
|
|
|
|
|
= note: `-D clippy::ref-as-ptr` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::ref_as_ptr)]`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:6:13
|
|
|
|
|
LL | let _ = &2u32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u32>(&2u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:7:13
|
|
|
|
|
LL | let _ = &3.0f64 as *const f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f64>(&3.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:9:13
|
|
|
|
|
LL | let _ = &4 as *const _ as *const f32;
|
|
| ^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&4)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:10:13
|
|
|
|
|
LL | let _ = &5.0f32 as *const f32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f32>(&5.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:12:13
|
|
|
|
|
LL | let _ = &mut 6u8 as *const _;
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut 6u8)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:13:13
|
|
|
|
|
LL | let _ = &mut 7u32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u32>(&mut 7u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:14:13
|
|
|
|
|
LL | let _ = &mut 8.0f64 as *const f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f64>(&mut 8.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:16:13
|
|
|
|
|
LL | let _ = &mut 9 as *const _ as *const f32;
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut 9)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:17:13
|
|
|
|
|
LL | let _ = &mut 10.0f32 as *const f32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f32>(&mut 10.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:19:13
|
|
|
|
|
LL | let _ = &mut 11u8 as *mut _;
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut 11u8)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:20:13
|
|
|
|
|
LL | let _ = &mut 12u32 as *mut u32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<u32>(&mut 12u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:21:13
|
|
|
|
|
LL | let _ = &mut 13.0f64 as *mut f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<f64>(&mut 13.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:23:13
|
|
|
|
|
LL | let _ = &mut 14 as *mut _ as *const f32;
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut 14)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:24:13
|
|
|
|
|
LL | let _ = &mut 15.0f32 as *mut f32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<f32>(&mut 15.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:26:13
|
|
|
|
|
LL | let _ = &1u8 as *const _;
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&1u8)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:27:13
|
|
|
|
|
LL | let _ = &2u32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u32>(&2u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:28:13
|
|
|
|
|
LL | let _ = &3.0f64 as *const f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f64>(&3.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:30:13
|
|
|
|
|
LL | let _ = &4 as *const _ as *const f32;
|
|
| ^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&4)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:31:13
|
|
|
|
|
LL | let _ = &5.0f32 as *const f32 as *const u32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f32>(&5.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:34:13
|
|
|
|
|
LL | let _ = &val as *const _;
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:35:13
|
|
|
|
|
LL | let _ = &val as *const i32;
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<i32>(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:37:13
|
|
|
|
|
LL | let _ = &val as *const _ as *const f32;
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:38:13
|
|
|
|
|
LL | let _ = &val as *const i32 as *const f64;
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<i32>(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:41:13
|
|
|
|
|
LL | let _ = &mut val as *mut u8;
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<u8>(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:42:13
|
|
|
|
|
LL | let _ = &mut val as *mut _;
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:44:13
|
|
|
|
|
LL | let _ = &mut val as *const u8;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u8>(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:45:13
|
|
|
|
|
LL | let _ = &mut val as *const _;
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:47:13
|
|
|
|
|
LL | let _ = &mut val as *const u8 as *const f64;
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u8>(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:48:32
|
|
|
|
|
LL | let _: *const Option<u8> = &mut val as *const _ as *const _;
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:50:13
|
|
|
|
|
LL | let _ = &std::array::from_fn(|i| i * i) as *const [usize; 7];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[usize; 7]>(&std::array::from_fn(|i| i * i))`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:51:13
|
|
|
|
|
LL | let _ = &mut std::array::from_fn(|i| i * i) as *const [usize; 8];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[usize; 8]>(&mut std::array::from_fn(|i| i * i))`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:52:13
|
|
|
|
|
LL | let _ = &mut std::array::from_fn(|i| i * i) as *mut [usize; 9];
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<[usize; 9]>(&mut std::array::from_fn(|i| i * i))`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:70:13
|
|
|
|
|
LL | let _ = val as *const i32;
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<i32>(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:71:13
|
|
|
|
|
LL | let _ = mut_val as *mut i32;
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<i32>(mut_val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:75:13
|
|
|
|
|
LL | let _ = val as *const _;
|
|
| ^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:76:13
|
|
|
|
|
LL | let _ = val as *const [u8];
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[u8]>(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:80:13
|
|
|
|
|
LL | let _ = val as *mut _;
|
|
| ^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:81:13
|
|
|
|
|
LL | let _ = val as *mut str;
|
|
| ^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<str>(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:88:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:92:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:100:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:104:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> $DIR/ref_as_ptr.rs:108:9
|
|
|
|
|
LL | self.0 as *mut _ as *mut _
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(self.0)`
|
|
|
|
error: aborting due to 44 previous errors
|
|
|