disk: resolve iter_nth_zero clippy warning

Replace .nth(0) with .next() to resolve this:

  error: called `.nth(0)` on a `std::iter::Iterator`

BUG=None
TEST=bin/clippy

Change-Id: I103e8b44b1564708d92d096aaf044db7f67d1ba8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2151147
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Daniel Verkamp 2020-04-15 12:38:38 -07:00 committed by Commit Bot
parent d8d9556184
commit fcf078c38a

View file

@ -120,7 +120,7 @@ impl<T: Cacheable> CacheMap<T> {
{
if self.map.len() == self.capacity {
// TODO(dgreid) - smarter eviction strategy.
let to_evict = *self.map.iter().nth(0).unwrap().0;
let to_evict = *self.map.iter().next().unwrap().0;
if let Some(evicted) = self.map.remove(&to_evict) {
if evicted.dirty() {
write_callback(to_evict, evicted)?;