From ea37e7ab877d737add8610e00b6881355dbdd892 Mon Sep 17 00:00:00 2001 From: "polka.dom" Date: Sun, 6 Oct 2024 11:43:43 -0400 Subject: [PATCH] Fix match that's always okay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- bounded-collections/src/bounded_btree_map.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bounded-collections/src/bounded_btree_map.rs b/bounded-collections/src/bounded_btree_map.rs index 39323ab8..25ba9840 100644 --- a/bounded-collections/src/bounded_btree_map.rs +++ b/bounded-collections/src/bounded_btree_map.rs @@ -72,10 +72,7 @@ where A: MapAccess<'de>, { let size = map.size_hint().unwrap_or(0); - let max = match usize::try_from(S::get()) { - Ok(n) => n, - Err(_) => return Err(A::Error::custom("can't convert to usize")), - }; + let max = S::get() as usize; if size > max { Err(A::Error::custom("map exceeds the size of the bounds")) } else {