34 lines
1.3 KiB
Text
34 lines
1.3 KiB
Text
error: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
|
|
--> tests/ui/double_ended_iterator_last.rs:5:5
|
|
|
|
|
LL | s.split(' ').last()
|
|
| ^^^^^^^^^^^^^------
|
|
| |
|
|
| help: try: `next_back()`
|
|
|
|
|
= note: `-D clippy::double-ended-iterator-last` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::double_ended_iterator_last)]`
|
|
|
|
error: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
|
|
--> tests/ui/double_ended_iterator_last.rs:22:13
|
|
|
|
|
LL | let _ = DeIterator.last();
|
|
| ^^^^^^^^^^^------
|
|
| |
|
|
| help: try: `next_back()`
|
|
|
|
error: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
|
|
--> tests/ui/double_ended_iterator_last.rs:96:36
|
|
|
|
|
LL | println!("Last element is {}", v.last().unwrap().0);
|
|
| ^^^^^^^^
|
|
|
|
|
= note: this change will alter drop order which may be undesirable
|
|
help: try
|
|
|
|
|
LL ~ let mut v = v.into_iter();
|
|
LL ~ println!("Last element is {}", v.next_back().unwrap().0);
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|