rust - patterns `0_u32` and `4_u32..=u32::MAX` not covered

 

Weird message from rust for the actual issue

If i have the following code, it will trigger this error and the reason is because I didn't cover the scenarios required

fn test(self, i: u32)  -> Result<i8, &'static str> {

        match i {
            1 => Ok(1),
            2 => Ok(2),
            3 => panic!("oh nonono"),
        }
    }

So adding a _ => panic("no value") - i was able to fix it

fn test(self, i: u32)  -> Result<i8, &'static str> {

        match i {
            1 => Ok(1),
            2 => Ok(2),
            3 => panic!("oh nonono"),
            _ => panic!("no value")
        }
    }

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm