From 2e5d59f84d056f90c985d762cbc935b081e4bb1b Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Tue, 13 Jun 2023 05:25:20 +0000 Subject: other: clean up some cfg usage (#1205) * other: convert some cfg if * fix --- src/app/layout_manager.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/app') diff --git a/src/app/layout_manager.rs b/src/app/layout_manager.rs index 4e7d3b0e..94e7f877 100644 --- a/src/app/layout_manager.rs +++ b/src/app/layout_manager.rs @@ -1012,9 +1012,11 @@ impl std::str::FromStr for BottomWidgetType { "temp" | "temperature" => Ok(BottomWidgetType::Temp), "disk" => Ok(BottomWidgetType::Disk), "empty" => Ok(BottomWidgetType::Empty), - "battery" | "batt" if cfg!(feature = "battery") => Ok(BottomWidgetType::Battery), + #[cfg(feature = "battery")] + "battery" | "batt" => Ok(BottomWidgetType::Battery), _ => { - if cfg!(feature = "battery") { + #[cfg(feature = "battery")] + { Err(BottomError::ConfigError(format!( "\"{}\" is an invalid widget name. @@ -1037,7 +1039,9 @@ Supported widget names: ", s ))) - } else { + } + #[cfg(not(feature = "battery"))] + { Err(BottomError::ConfigError(format!( "\"{}\" is an invalid widget name. -- cgit v1.2.3