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

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type