It makes sense to lint the use of next_back in cases where the iterator is not used beyond the call to next_back, suggesting to replace last instead. Additionally, implementations of Iterator::last that only delegate to next_back should be suggested to be removed.
This will likely need to be special cased to only do this for iterators which are known to optimise last into next_back through some sort of whitelist.
It makes sense to lint the use of
next_backin cases where the iterator is not used beyond the call tonext_back, suggesting to replacelastinstead. Additionally, implementations ofIterator::lastthat only delegate tonext_backshould be suggested to be removed.This will likely need to be special cased to only do this for iterators which are known to optimise
lastintonext_backthrough some sort of whitelist.