1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-30 18:37:46 +00:00

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

This commit is contained in:
NotAShelf 2025-05-17 07:49:49 +03:00
parent af04876ad8
commit 661cd7da1a
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

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(())
} }