File tree 3 files changed +18
-18
lines changed
3 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ fn main() {
9
9
let offset_isize = 1_isize;
10
10
11
11
unsafe {
12
- ptr.add(offset_usize);
13
- ptr.offset(offset_isize as isize);
14
- ptr.offset(offset_u8 as isize);
12
+ let _ = ptr.add(offset_usize);
13
+ let _ = ptr.offset(offset_isize as isize);
14
+ let _ = ptr.offset(offset_u8 as isize);
15
15
16
- ptr.wrapping_add(offset_usize);
17
- ptr.wrapping_offset(offset_isize as isize);
18
- ptr.wrapping_offset(offset_u8 as isize);
16
+ let _ = ptr.wrapping_add(offset_usize);
17
+ let _ = ptr.wrapping_offset(offset_isize as isize);
18
+ let _ = ptr.wrapping_offset(offset_u8 as isize);
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ fn main() {
9
9
let offset_isize = 1_isize ;
10
10
11
11
unsafe {
12
- ptr. offset ( offset_usize as isize ) ;
13
- ptr. offset ( offset_isize as isize ) ;
14
- ptr. offset ( offset_u8 as isize ) ;
12
+ let _ = ptr. offset ( offset_usize as isize ) ;
13
+ let _ = ptr. offset ( offset_isize as isize ) ;
14
+ let _ = ptr. offset ( offset_u8 as isize ) ;
15
15
16
- ptr. wrapping_offset ( offset_usize as isize ) ;
17
- ptr. wrapping_offset ( offset_isize as isize ) ;
18
- ptr. wrapping_offset ( offset_u8 as isize ) ;
16
+ let _ = ptr. wrapping_offset ( offset_usize as isize ) ;
17
+ let _ = ptr. wrapping_offset ( offset_isize as isize ) ;
18
+ let _ = ptr. wrapping_offset ( offset_u8 as isize ) ;
19
19
}
20
20
}
Original file line number Diff line number Diff line change 1
1
error: use of `offset` with a `usize` casted to an `isize`
2
- --> $DIR/ptr_offset_with_cast.rs:12:9
2
+ --> $DIR/ptr_offset_with_cast.rs:12:17
3
3
|
4
- LL | ptr.offset(offset_usize as isize);
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.add(offset_usize)`
4
+ LL | let _ = ptr.offset(offset_usize as isize);
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.add(offset_usize)`
6
6
|
7
7
= note: `-D clippy::ptr-offset-with-cast` implied by `-D warnings`
8
8
9
9
error: use of `wrapping_offset` with a `usize` casted to an `isize`
10
- --> $DIR/ptr_offset_with_cast.rs:16:9
10
+ --> $DIR/ptr_offset_with_cast.rs:16:17
11
11
|
12
- LL | ptr.wrapping_offset(offset_usize as isize);
13
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.wrapping_add(offset_usize)`
12
+ LL | let _ = ptr.wrapping_offset(offset_usize as isize);
13
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr.wrapping_add(offset_usize)`
14
14
15
15
error: aborting due to 2 previous errors
16
16
You can’t perform that action at this time.
0 commit comments