From 10ac0c1b54561f732341b9c13bb4f22a25a1a18d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 18 May 2021 02:20:17 +0100 Subject: [PATCH] cargo update: Update to latest ArrayVec, const generics Signed-off-by: Ian Jackson --- Cargo.lock | 12 +++++++++--- apitest/at-otter.rs | 4 ++-- apitest/main.rs | 4 ++-- base/Cargo.toml | 2 +- base/geometry.rs | 6 +++--- base/misc.rs | 2 +- src/bin/otter.rs | 2 +- src/bundles.rs | 2 +- src/clock.rs | 2 +- src/gamestate.rs | 2 +- src/global.rs | 2 +- src/shapelib.rs | 6 +++--- src/utils.rs | 4 ++-- 13 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 022dc2cb..2e6c9d04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,6 +113,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7" + [[package]] name = "ascii" version = "1.0.0" @@ -212,7 +218,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" dependencies = [ "arrayref", - "arrayvec", + "arrayvec 0.5.2", "constant_time_eq", ] @@ -1720,7 +1726,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16cb54cd28cb3d2e964d9444ca185676a94fd9b7cce5f02b22c717947ed8e9a2" dependencies = [ - "arrayvec", + "arrayvec 0.5.2", ] [[package]] @@ -2335,7 +2341,7 @@ dependencies = [ name = "otter-base" version = "0.5.1" dependencies = [ - "arrayvec", + "arrayvec 0.7.0", "derive_more", "extend", "fehler", diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index 46e6016a..1810d27b 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -44,7 +44,7 @@ impl Ctx { p.info["desc"] == otter::hand::UNCLAIMED_HAND_DESC }) .map(|(i,_)| i) - .collect::>() + .collect::>() .into_inner().unwrap(); dbgc!(&hand); @@ -60,7 +60,7 @@ impl Ctx { .filter(|(_i,p)| p.info["desc"].as_str().unwrap().ends_with(" pawn")) .map(|(i,_)| i) .take(2) - .collect::>() + .collect::>() .into_inner().unwrap(); pawns.sort_by_key(|&p| -pieces[p].pos.x()); diff --git a/apitest/main.rs b/apitest/main.rs index 5938b8c5..9336a0d0 100644 --- a/apitest/main.rs +++ b/apitest/main.rs @@ -518,7 +518,7 @@ impl UsualCtx { let pieces = session.pieces::()?; let llm = pieces.into_iter() .filter(|pi| pi.info["desc"] == "a library load area marker") - .collect::>(); + .collect::>(); let llm: [_;2] = llm.into_inner().unwrap(); dbgc!(&llm); @@ -632,7 +632,7 @@ impl UsualCtx { let [alice, bob]: [Player; 2] = su.ds.setup_static_users(&mut mc, default())? .into_iter().map(|sus| Player { nick: sus.nick, url: sus.url }) - .collect::>().into_inner().unwrap(); + .collect::>().into_inner().unwrap(); drop(mc); let su_rc = Rc::new(RefCell::new(su)); diff --git a/base/Cargo.toml b/base/Cargo.toml index 95504a46..cbf161f0 100644 --- a/base/Cargo.toml +++ b/base/Cargo.toml @@ -22,7 +22,7 @@ path="lib.rs" [dependencies] -arrayvec="0.5" +arrayvec="0.7" derive_more="0.99" extend="1" htmlescape="0.3" diff --git a/base/geometry.rs b/base/geometry.rs index 44a31d7a..9d2385a7 100644 --- a/base/geometry.rs +++ b/base/geometry.rs @@ -131,7 +131,7 @@ impl PosC { #[throws(PosCFromIteratorError)] pub fn from_iter>(i: I) -> Self { PosC{ coords: i - .collect::>() + .collect::>() .into_inner() .map_err(|_| PosCFromIteratorError)? }} @@ -140,7 +140,7 @@ impl PosC { impl PosC where T: Debug { pub fn from_iter_2>(i: I) -> Self { PosC{ coords: i - .collect::>() + .collect::>() .into_inner() .unwrap() }} @@ -161,7 +161,7 @@ impl PosC { I: Iterator> >(i: I) -> Self { PosC{ coords: i - .collect::,E>>()? + .collect::,E>>()? .into_inner().unwrap() }} } diff --git a/base/misc.rs b/base/misc.rs index c34a258f..c94c3db5 100644 --- a/base/misc.rs +++ b/base/misc.rs @@ -12,7 +12,7 @@ pub const SVG_SCALE: f64 = 6.; pub fn timestring_abbreviate<'x>(base: &str, this: &'x str) -> (&'x str, bool) { - fn split(s: &str) -> ArrayVec<[&str; 3]> { + fn split(s: &str) -> ArrayVec<&str, 3> { s.splitn(3, ' ').collect() } let base3 = split(base); diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 67b2d2da..a25367ea 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -1146,7 +1146,7 @@ mod library_add { Poor(insns, "surplus marker(s) removed") } else { - let mut good: ArrayVec<_> = default(); + let mut good: ArrayVec<_,2> = default(); for p in &markers { good.push(p.visible.as_ref().ok_or_else( || anyhow!("library marker(s) with hidden position!") diff --git a/src/bundles.rs b/src/bundles.rs index 6a58e84d..c7bc2c9b 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -208,7 +208,7 @@ impl FromStr for BundleSavefile { #[throws(NotBundle)] fn from_str(fleaf: &str) -> BundleSavefile { let [lhs, rhs] = fleaf.splitn(2, '.') - .collect::>() + .collect::>() .into_inner().map_err(|_| "no dot")?; let index = lhs.parse().map_err(|_| "bad index")?; if rhs == "tmp" { return BundleSavefile::PreviousUploadFailed(index) } diff --git a/src/clock.rs b/src/clock.rs index b3276f06..f9839b26 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -237,7 +237,7 @@ impl Clock { URender { st, remaining, nick } }) - .collect::>() + .collect::>() .into_inner().unwrap(); if r.iter().filter(|ur| ur.st == URS::Reset).count() == 1 { diff --git a/src/gamestate.rs b/src/gamestate.rs index 9a7d4056..347cf654 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -229,7 +229,7 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static { Rect { corners: self.bbox_approx()?.corners.iter().map( |c| *c + p.pos ) - .collect::,_>>()? + .collect::,_>>()? .into_inner().unwrap() } } } diff --git a/src/global.rs b/src/global.rs index bf94ce0e..c9ae90d5 100644 --- a/src/global.rs +++ b/src/global.rs @@ -853,7 +853,7 @@ impl<'ig> InstanceGuard<'ig> { access }; - let current_tokens: ArrayVec<[&RawToken;2]> = { + let current_tokens: ArrayVec<&RawToken,2> = { let players = GLOBAL.players.read(); self.tokens_players.tr.iter(). filter(|&token| (||{ diff --git a/src/shapelib.rs b/src/shapelib.rs index 16147dd4..a2d166c1 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -285,7 +285,7 @@ impl FaceTransform { }) .cycle() .take(2) - .collect::>() + .collect::>() .into_inner() .unwrap() } else { @@ -303,7 +303,7 @@ impl FaceTransform { }.iter().cloned().zip(&scale).map(|(size,scale)| { size * 0.5 / scale }) - .collect::>() + .collect::>() .into_inner() .unwrap() }))?; @@ -1005,7 +1005,7 @@ impl RectShape { [-1,1].iter().map(|&signum| Ok::<_,CoordinateOverflow>({ (centre + (offset * signum)?)? })) - .collect::,_>>()? + .collect::,_>>()? .into_inner().unwrap() }; rect diff --git a/src/utils.rs b/src/utils.rs index 00f3c836..fd2e530b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -55,7 +55,7 @@ impl OldNew { pub fn map U>(&self, f: F) -> OldNew { OldNew( self.iter().map(f) - .collect::>() + .collect::>() .into_inner() .unwrap_or_else(|_|panic!()) ) @@ -64,7 +64,7 @@ impl OldNew { pub fn as_refs(&self) -> OldNew<&T> { OldNew( self.iter() - .collect::>() + .collect::>() .into_inner() .unwrap_or_else(|_|panic!()) ) -- 2.30.2