From bbc3001a90a9d36b4454656e4a3c42024c0f5d2c Mon Sep 17 00:00:00 2001 From: W Etheredge Date: Mon, 8 Jul 2024 17:30:20 -0500 Subject: [PATCH] Use assert!() to check prefix_len in Ipv4Cidr::new --- src/wire/ipv4.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/wire/ipv4.rs b/src/wire/ipv4.rs index 1f09bda4b..b5f7894b3 100644 --- a/src/wire/ipv4.rs +++ b/src/wire/ipv4.rs @@ -156,11 +156,8 @@ impl Cidr { /// /// # Panics /// This function panics if the prefix length is larger than 32. - #[allow(clippy::no_effect)] pub const fn new(address: Address, prefix_len: u8) -> Cidr { - // Replace with const panic (or assert) when stabilized - // see: https://github.com/rust-lang/rust/issues/51999 - ["Prefix length should be <= 32"][(prefix_len > 32) as usize]; + assert!(prefix_len <= 32); Cidr { address, prefix_len,