mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
add test for *&[a, b,...]`
This commit is contained in:
parent
76856ffb57
commit
4dcab72c1c
3 changed files with 23 additions and 3 deletions
|
@ -43,6 +43,10 @@ fn main() {
|
|||
let b = *aref;
|
||||
|
||||
let _ = unsafe { *core::ptr::addr_of!(a) };
|
||||
|
||||
// do NOT lint for array as sematic differences with/out `*&`.
|
||||
let _repeat = [0; 64];
|
||||
let _arr = [0, 1, 2, 3, 4];
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
|
@ -43,6 +43,10 @@ fn main() {
|
|||
let b = **&aref;
|
||||
|
||||
let _ = unsafe { *core::ptr::addr_of!(a) };
|
||||
|
||||
// do NOT lint for array as sematic differences with/out `*&`.
|
||||
let _repeat = *&[0; 64];
|
||||
let _arr = *&[0, 1, 2, 3, 4];
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
|
@ -50,7 +50,19 @@ LL | let b = **&aref;
|
|||
| ^^^^^^ help: try: `aref`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> tests/ui/deref_addrof.rs:53:17
|
||||
--> tests/ui/deref_addrof.rs:48:19
|
||||
|
|
||||
LL | let _repeat = *&[0; 64];
|
||||
| ^^^^^^^^^ help: try: `[0; 64]`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> tests/ui/deref_addrof.rs:49:16
|
||||
|
|
||||
LL | let _arr = *&[0, 1, 2, 3, 4];
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `[0, 1, 2, 3, 4]`
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> tests/ui/deref_addrof.rs:57:17
|
||||
|
|
||||
LL | inline!(*& $(@expr self))
|
||||
| ^^^^^^^^^^^^^^^^ help: try: `$(@expr self)`
|
||||
|
@ -58,12 +70,12 @@ LL | inline!(*& $(@expr self))
|
|||
= note: this error originates in the macro `__inline_mac_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: immediately dereferencing a reference
|
||||
--> tests/ui/deref_addrof.rs:57:17
|
||||
--> tests/ui/deref_addrof.rs:61:17
|
||||
|
|
||||
LL | inline!(*&mut $(@expr self))
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: try: `$(@expr self)`
|
||||
|
|
||||
= note: this error originates in the macro `__inline_mac_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue