Skip to content

Commit

Permalink
Fix match that's always okay
Browse files Browse the repository at this point in the history
Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
PolkadotDom and bkchr authored Oct 6, 2024
1 parent 6f77ce5 commit ea37e7a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions bounded-collections/src/bounded_btree_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ea37e7a

Please sign in to comment.