diff options
Diffstat (limited to 'src/pomo')
| -rw-r--r-- | src/pomo/mod.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/pomo/mod.rs b/src/pomo/mod.rs index be55a0d..42ce627 100644 --- a/src/pomo/mod.rs +++ b/src/pomo/mod.rs @@ -35,14 +35,14 @@ impl Pomo { let mut app = Pomo::new(); if let Some(proj_dirs) = ProjectDirs::from("", "", "pomoru") { let config_path = proj_dirs.config_dir().join("config.toml"); - if let Ok(content) = fs::read_to_string(config_path) { - if let Ok(config) = toml::from_str::<Config>(&content) { - app.work_time = Duration::from_secs(config.work_time_mins * 60); - app.short_break_time = Duration::from_secs(config.short_break_mins * 60); - app.long_break_time = Duration::from_secs(config.long_break_mins * 60); - app.tasks = config.tasks; - app.reset_timer_to_mode(); - } + if let Ok(content) = fs::read_to_string(config_path) + && let Ok(config) = toml::from_str::<Config>(&content) + { + app.work_time = Duration::from_secs(config.work_time_mins * 60); + app.short_break_time = Duration::from_secs(config.short_break_mins * 60); + app.long_break_time = Duration::from_secs(config.long_break_mins * 60); + app.tasks = config.tasks; + app.reset_timer_to_mode(); } } app @@ -67,14 +67,13 @@ impl Pomo { // Tighten poll to 16ms (~60fps feel) for input responsiveness event_res = tokio::task::spawn_blocking(|| event::poll(Duration::from_millis(16))) => { - if let Ok(Ok(true)) = event_res { - if let Ok(Event::Key(key)) = event::read() { - if key.kind == event::KeyEventKind::Press { - self.handle_key(key); - } - } + if let Ok(Ok(true)) = event_res + && let Ok(Event::Key(key)) = event::read() + && key.kind == event::KeyEventKind::Press + { + self.handle_key(key); } - } + } } if self.should_quit { |