about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/ptr_offset_with_cast.stderr
blob: 022b3286c93b72c859a76e9f38c5cba7bf7c2f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
error: use of `offset` with a `usize` casted to an `isize`
  --> tests/ui/ptr_offset_with_cast.rs:12:17
   |
LL |         let _ = ptr.offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::ptr-offset-with-cast` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::ptr_offset_with_cast)]`
help: use `add` instead
   |
LL -         let _ = ptr.offset(offset_usize as isize);
LL +         let _ = ptr.add(offset_usize);
   |

error: use of `wrapping_offset` with a `usize` casted to an `isize`
  --> tests/ui/ptr_offset_with_cast.rs:17:17
   |
LL |         let _ = ptr.wrapping_offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `wrapping_add` instead
   |
LL -         let _ = ptr.wrapping_offset(offset_usize as isize);
LL +         let _ = ptr.wrapping_add(offset_usize);
   |

error: use of `offset` with a `usize` casted to an `isize`
  --> tests/ui/ptr_offset_with_cast.rs:25:17
   |
LL |         let _ = (&ptr).offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `add` instead
   |
LL -         let _ = (&ptr).offset(offset_usize as isize);
LL +         let _ = (&ptr).add(offset_usize);
   |

error: use of `wrapping_offset` with a `usize` casted to an `isize`
  --> tests/ui/ptr_offset_with_cast.rs:27:17
   |
LL |         let _ = (&ptr).wrapping_offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `wrapping_add` instead
   |
LL -         let _ = (&ptr).wrapping_offset(offset_usize as isize);
LL +         let _ = (&ptr).wrapping_add(offset_usize);
   |

error: aborting due to 4 previous errors