eth phy: use unreachable!() for impossible values

This commit is contained in:
mwojcik 2022-03-10 16:45:29 +08:00
parent 072fd5f015
commit c4c52c33b4
2 changed files with 2 additions and 3 deletions

View File

@ -24,7 +24,7 @@ impl Leds {
0b1101 => Led0Control::Mode2, 0b1101 => Led0Control::Mode2,
0b1110 => Led0Control::Mode3, 0b1110 => Led0Control::Mode3,
0b1111 => Led0Control::Mode4, 0b1111 => Led0Control::Mode4,
_ => Led0Control::OnLinkOffNoLink, //impossible, but Rust compiler requires it _ => unreachable!()
} }
} }
pub fn led1(&self) -> Led1Control { pub fn led1(&self) -> Led1Control {
@ -41,7 +41,7 @@ impl Leds {
0b1001 => Led1Control::ForceOn, 0b1001 => Led1Control::ForceOn,
0b1010 => Led1Control::ForceHiZ, 0b1010 => Led1Control::ForceHiZ,
0b1011 => Led1Control::ForceBlink, 0b1011 => Led1Control::ForceBlink,
_ => Led1Control::Invalid, //impossible, but Rust compiler requires it _ => unreachable!()
} }
} }

View File

@ -62,7 +62,6 @@ pub enum Led1Control {
ForceOn = 0b1001, ForceOn = 0b1001,
ForceHiZ = 0b1010, ForceHiZ = 0b1010,
ForceBlink = 0b1011, ForceBlink = 0b1011,
Invalid
} }
pub trait PhyAccess { pub trait PhyAccess {