Skip to content

Commit

Permalink
Refactor switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert24GG committed Feb 13, 2024
1 parent 82e270f commit 728508e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/global_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ pub(crate) fn handle_application_args(

match (value, value.parse::<i8>()) {
// Parse custom step values
(_, Ok(num)) if coef == 1 => (ArgTypes::BrightnessRaise, Some(num.to_string())),
(_, Ok(num)) if coef == -1 => {
(ArgTypes::BrightnessLower, Some(num.abs().to_string()))
}
(_, Ok(num)) if coef == 0 => (ArgTypes::BrightnessSet, Some(num.to_string())),
(_, Ok(num)) => match coef {
1 => (ArgTypes::BrightnessRaise, Some(num.to_string())),
-1 => (ArgTypes::BrightnessLower, Some(num.abs().to_string())),
_ => (ArgTypes::BrightnessSet, Some(num.to_string())),
},

("raise", _) => (ArgTypes::BrightnessRaise, None),
("lower", _) => (ArgTypes::BrightnessLower, None),
Expand Down

0 comments on commit 728508e

Please sign in to comment.