From 8071174f27956a2ff23ce5130474bb054b51156e Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Wed, 1 Nov 2023 03:19:56 -0400 Subject: [PATCH] Make clippy happy --- hybrid-array/src/impl_serde.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hybrid-array/src/impl_serde.rs b/hybrid-array/src/impl_serde.rs index a73ea313..0ffed100 100644 --- a/hybrid-array/src/impl_serde.rs +++ b/hybrid-array/src/impl_serde.rs @@ -74,7 +74,9 @@ where // If there's a value allegedly remaining, and deserializing it doesn't fail, then that's a // length mismatch error if seq.size_hint() != Some(0) && seq.next_element::()?.is_some() { - Err(de::Error::invalid_length(N::USIZE + 1, &self)) + // The addition only saturates if this array is the size of all addressable memory. Not + // going to happen. And if it did, the only effect is an off-by-one error message + Err(de::Error::invalid_length(N::USIZE.saturating_add(1), &self)) } else { arr }