mirror of
https://github.com/smoltcp-rs/smoltcp.git
synced 2025-10-02 15:15:05 +00:00
Use assert!() to check prefix_len in Ipv4Cidr::new
This commit is contained in:
parent
99ddd22cdb
commit
bbc3001a90
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user