1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-27 17:07:44 +00:00

main: revert un-idiomatic \err.into()\ pattern

This commit is contained in:
NotAShelf 2025-05-17 07:49:49 +03:00 committed by raf
parent b170fa0dd0
commit 601735957b

View file

@ -464,15 +464,13 @@ fn init_logger() {
fn validate_freq(freq_mhz: u32, label: &str) -> Result<(), AppError> { fn validate_freq(freq_mhz: u32, label: &str) -> Result<(), AppError> {
if freq_mhz == 0 { if freq_mhz == 0 {
error!("{label} frequency cannot be zero"); error!("{label} frequency cannot be zero");
let err = ControlError::InvalidValueError(format!("{label} frequency cannot be zero")); Err(AppError::Generic(format!("{label} frequency cannot be zero")))
Err(err.into())
} else if freq_mhz > 10000 { } else if freq_mhz > 10000 {
// Extremely high value unlikely to be valid // Extremely high value unlikely to be valid
error!("{label} frequency ({freq_mhz} MHz) is unreasonably high"); error!("{label} frequency ({freq_mhz} MHz) is unreasonably high");
let err = ControlError::InvalidValueError(format!( Err(AppError::Generic(format!(
"{label} frequency ({freq_mhz} MHz) is unreasonably high" "{label} frequency ({freq_mhz} MHz) is unreasonably high"
)); )))
Err(err.into())
} else { } else {
Ok(()) Ok(())
} }