From c4c52c33b4c8cbf9b1fe48832cf1c202b87761da Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 10 Mar 2022 16:45:29 +0800 Subject: [PATCH] eth phy: use unreachable!() for impossible values --- libboard_zynq/src/eth/phy/leds.rs | 4 ++-- libboard_zynq/src/eth/phy/mod.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libboard_zynq/src/eth/phy/leds.rs b/libboard_zynq/src/eth/phy/leds.rs index 27813a7..73585df 100644 --- a/libboard_zynq/src/eth/phy/leds.rs +++ b/libboard_zynq/src/eth/phy/leds.rs @@ -24,7 +24,7 @@ impl Leds { 0b1101 => Led0Control::Mode2, 0b1110 => Led0Control::Mode3, 0b1111 => Led0Control::Mode4, - _ => Led0Control::OnLinkOffNoLink, //impossible, but Rust compiler requires it + _ => unreachable!() } } pub fn led1(&self) -> Led1Control { @@ -41,7 +41,7 @@ impl Leds { 0b1001 => Led1Control::ForceOn, 0b1010 => Led1Control::ForceHiZ, 0b1011 => Led1Control::ForceBlink, - _ => Led1Control::Invalid, //impossible, but Rust compiler requires it + _ => unreachable!() } } diff --git a/libboard_zynq/src/eth/phy/mod.rs b/libboard_zynq/src/eth/phy/mod.rs index 950e56e..84cd06f 100644 --- a/libboard_zynq/src/eth/phy/mod.rs +++ b/libboard_zynq/src/eth/phy/mod.rs @@ -62,7 +62,6 @@ pub enum Led1Control { ForceOn = 0b1001, ForceHiZ = 0b1010, ForceBlink = 0b1011, - Invalid } pub trait PhyAccess {