diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-06-12 23:02:59 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-06-12 23:02:59 +0530 |
| commit | 19f172f13b6651f8725784a7b1571be784b80df8 (patch) | |
| tree | 6f41ceab73ed54f47fd01a8306d6ddbaf0d7cff1 /src | |
| parent | 5cefa09f4a340ecd0c4feeca499d80cf24468e17 (diff) | |
| download | pomoru-19f172f13b6651f8725784a7b1571be784b80df8.tar.xz pomoru-19f172f13b6651f8725784a7b1571be784b80df8.zip | |
shorten if let in state using chained if let
Diffstat (limited to 'src')
| -rw-r--r-- | src/pomo/state.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/pomo/state.rs b/src/pomo/state.rs index 46c2dc1..2a59042 100644 --- a/src/pomo/state.rs +++ b/src/pomo/state.rs @@ -43,20 +43,20 @@ impl Default for Theme { if let Some(base_dirs) = BaseDirs::new() { let path = base_dirs.home_dir().join(".config/noctalia/colors.json"); - if let Ok(content) = fs::read_to_string(&path) { - if let Ok(colors) = serde_json::from_str::<NoctaliaColors>(&content) { - if let Some(c) = parse_hex_color(&colors.m_primary) { - theme.primary = c; - } - if let Some(c) = parse_hex_color(&colors.m_on_surface_variant) { - theme.overlay0 = c; - } - if let Some(c) = parse_hex_color(&colors.m_surface_variant) { - theme.surface0 = c; - } - if let Some(c) = parse_hex_color(&colors.m_on_surface) { - theme.text = c; - } + if let Ok(content) = fs::read_to_string(&path) + && let Ok(colors) = serde_json::from_str::<NoctaliaColors>(&content) + { + if let Some(c) = parse_hex_color(&colors.m_primary) { + theme.primary = c; + } + if let Some(c) = parse_hex_color(&colors.m_on_surface_variant) { + theme.overlay0 = c; + } + if let Some(c) = parse_hex_color(&colors.m_surface_variant) { + theme.surface0 = c; + } + if let Some(c) = parse_hex_color(&colors.m_on_surface) { + theme.text = c; } } } @@ -180,7 +180,7 @@ impl Pomo { match self.mode { SessionMode::Work => { self.break_count += 1; - if self.break_count % 3 == 0 { + if self.break_count.is_multiple_of(3) { self.mode = SessionMode::LongBreak; self.time_remaining = self.long_break_time; self.total_duration = self.long_break_time; |