diff options
author | Joris | 2022-02-27 13:25:27 +0100 |
---|---|---|
committer | Joris | 2022-02-27 13:25:27 +0100 |
commit | e84d7e08c780133bd16a5a320bb786b5d22fddad (patch) | |
tree | 75164f20d5a8200a401862fe081e00a096051838 /src/model | |
parent | a83697a4d919c2b8307de10f60df5a4ae32f3a69 (diff) |
Change week with arrow keys
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/repetition.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/model/repetition.rs b/src/model/repetition.rs index 5288358..2e790d1 100644 --- a/src/model/repetition.rs +++ b/src/model/repetition.rs @@ -15,7 +15,9 @@ pub enum DayOfMonth { } pub fn validate_period(str: &str) -> Result<u32, String> { - let n = str.parse::<u32>().map_err(|_| format!("{} n’est pas une période valide.", str))?; + let n = str + .parse::<u32>() + .map_err(|_| format!("{} n’est pas une période valide.", str))?; if n == 0 { Err("La periode doit être positive.".to_string()) } else { @@ -23,9 +25,10 @@ pub fn validate_period(str: &str) -> Result<u32, String> { } } - pub fn validate_day(str: &str) -> Result<u8, String> { - let n = str.parse::<u8>().map_err(|_| format!("« {} » n’est pas un jour valide.", str))?; + let n = str + .parse::<u8>() + .map_err(|_| format!("« {} » n’est pas un jour valide.", str))?; if (1..=31).contains(&n) { Ok(n) } else { |