2019-05-20 19:01:21 -05:00
|
|
|
error: accessing last element with `x.get(x.len() - 1)`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/get_last_with_len.rs:8:13
|
2019-05-20 19:01:21 -05:00
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
LL | let _ = x.get(x.len() - 1);
|
2019-05-20 19:01:21 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `x.last()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::get-last-with-len` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::get_last_with_len)]`
|
2019-05-20 19:01:21 -05:00
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
error: accessing last element with `s.field.get(s.field.len() - 1)`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/get_last_with_len.rs:32:13
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let _ = s.field.get(s.field.len() - 1);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.field.last()`
|
|
|
|
|
|
|
|
error: accessing last element with `slice.get(slice.len() - 1)`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/get_last_with_len.rs:37:13
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let _ = slice.get(slice.len() - 1);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `slice.last()`
|
|
|
|
|
|
|
|
error: accessing last element with `array.get(array.len() - 1)`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/get_last_with_len.rs:40:13
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let _ = array.get(array.len() - 1);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array.last()`
|
|
|
|
|
|
|
|
error: accessing last element with `deq.get(deq.len() - 1)`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/get_last_with_len.rs:43:13
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let _ = deq.get(deq.len() - 1);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `deq.back()`
|
|
|
|
|
|
|
|
error: accessing last element with `nested[0].get(nested[0].len() - 1)`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/get_last_with_len.rs:46:13
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
|
LL | let _ = nested[0].get(nested[0].len() - 1);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `nested[0].last()`
|
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
2019-05-20 19:01:21 -05:00
|
|
|
|