mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Update test after const_ptr functions are must_use now
This commit is contained in:
parent
b8098fe4cc
commit
da9b138ec7
3 changed files with 18 additions and 18 deletions
|
@ -9,12 +9,12 @@ fn main() {
|
|||
let offset_isize = 1_isize;
|
||||
|
||||
unsafe {
|
||||
ptr.add(offset_usize);
|
||||
ptr.offset(offset_isize as isize);
|
||||
ptr.offset(offset_u8 as isize);
|
||||
let _ = ptr.add(offset_usize);
|
||||
let _ = ptr.offset(offset_isize as isize);
|
||||
let _ = ptr.offset(offset_u8 as isize);
|
||||
|
||||
ptr.wrapping_add(offset_usize);
|
||||
ptr.wrapping_offset(offset_isize as isize);
|
||||
ptr.wrapping_offset(offset_u8 as isize);
|
||||
let _ = ptr.wrapping_add(offset_usize);
|
||||
let _ = ptr.wrapping_offset(offset_isize as isize);
|
||||
let _ = ptr.wrapping_offset(offset_u8 as isize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@ fn main() {
|
|||
let offset_isize = 1_isize;
|
||||
|
||||
unsafe {
|
||||
ptr.offset(offset_usize as isize);
|
||||
ptr.offset(offset_isize as isize);
|
||||
ptr.offset(offset_u8 as isize);
|
||||
let _ = ptr.offset(offset_usize as isize);
|
||||
let _ = ptr.offset(offset_isize as isize);
|
||||
let _ = ptr.offset(offset_u8 as isize);
|
||||
|
||||
ptr.wrapping_offset(offset_usize as isize);
|
||||
ptr.wrapping_offset(offset_isize as isize);
|
||||
ptr.wrapping_offset(offset_u8 as isize);
|
||||
let _ = ptr.wrapping_offset(offset_usize as isize);
|
||||
let _ = ptr.wrapping_offset(offset_isize as isize);
|
||||
let _ = ptr.wrapping_offset(offset_u8 as isize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
error: use of `offset` with a `usize` casted to an `isize`
|
||||
--> $DIR/ptr_offset_with_cast.rs:12:9
|
||||
--> $DIR/ptr_offset_with_cast.rs:12:17
|
||||
|
|
||||
LL | ptr.offset(offset_usize as isize);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.add(offset_usize)`
|
||||
LL | let _ = ptr.offset(offset_usize as isize);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.add(offset_usize)`
|
||||
|
|
||||
= note: `-D clippy::ptr-offset-with-cast` implied by `-D warnings`
|
||||
|
||||
error: use of `wrapping_offset` with a `usize` casted to an `isize`
|
||||
--> $DIR/ptr_offset_with_cast.rs:16:9
|
||||
--> $DIR/ptr_offset_with_cast.rs:16:17
|
||||
|
|
||||
LL | ptr.wrapping_offset(offset_usize as isize);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.wrapping_add(offset_usize)`
|
||||
LL | let _ = ptr.wrapping_offset(offset_usize as isize);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.wrapping_add(offset_usize)`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue