From 8ef433a4d90fafa632d84d7d9b0f0f3703575ffb Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Tue, 5 Feb 2019 19:32:55 +0100 Subject: [PATCH] Minor cleanup --- src/{pin_iterator.rs => iter.rs} | 2 +- src/lib.rs | 4 ++-- src/list.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/{pin_iterator.rs => iter.rs} (96%) diff --git a/src/pin_iterator.rs b/src/iter.rs similarity index 96% rename from src/pin_iterator.rs rename to src/iter.rs index 0b0fe08..27f8b37 100644 --- a/src/pin_iterator.rs +++ b/src/iter.rs @@ -1,5 +1,5 @@ use { - core::{marker::Unpin, pin::Pin}, + core::pin::Pin, pin_utils::pin_mut, }; diff --git a/src/lib.rs b/src/lib.rs index d4fc6f5..283d5f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,7 @@ pub mod gen_iter; #[macro_use] mod utils; -pub mod pin_iterator; -pub use self::pin_iterator::{map, FusedPinIterator, PinIterator}; +pub mod iter; +pub use self::iter::{FusedPinIterator, PinIterator}; pub mod list; diff --git a/src/list.rs b/src/list.rs index db73ef7..b5d69c8 100644 --- a/src/list.rs +++ b/src/list.rs @@ -40,7 +40,7 @@ impl List { } pin_let!(nodes = self.iter_nodes()); - while let Some(node) = nodes.as_mut().next() { + for node in nodes.as_mut().iter() { if node.next == to_remove.as_mut().as_ptr() { *node.project().next = *to_remove.as_mut().project().next; to_remove.on_detached(); @@ -66,7 +66,7 @@ impl List { pub fn iter<'a>(self: Pin<&'a mut Self>) -> impl PinIterator + 'a { gen_iter! { pin_let!(nodes = self.iter_nodes()); - while let Some(node) = nodes.as_mut().next() { + for node in nodes.as_mut().iter() { yield node.project().value; } }