chiark / gitweb /
Revert "edges in other order"
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 29 Oct 2022 21:35:06 +0000 (22:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 29 Oct 2022 21:35:06 +0000 (22:35 +0100)
This reverts commit 8a44d2efe9db7ce76c33d5d28fe10af5b60ba7cb.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/lib.rs

index 58bbc56ea29fc80dc5839ff40fff8921016cac90..06566d826eae6617b597ed08355daf757fdca64c 100644 (file)
@@ -5,7 +5,7 @@ pub use std::io;
 pub use std::io::Write as _;
 pub use std::iter;
 
-pub use itertools::{chain, izip};
+pub use itertools::izip;
 pub use itertools::Itertools;
 
 pub fn default<T: Default>() -> T { Default::default() }
@@ -45,10 +45,10 @@ pub fn shape_abut_zero(shape: &mut Shape) {
 pub fn shape_edges(shape: &Shape)
                    -> impl Iterator<Item=[Point; 2]> + Clone + '_
 {
-  chain!(
-    shape.iter().rev().take(1),
-    shape,
-  )
+  shape
+    .iter()
+    .cycle()
+    .take(shape.len() + 1)
     .tuple_windows()
     .map(|(&a,&b)| [a,b])
 }