diff --git a/src/ui/default.rs b/src/ui/default.rs index 2534fbf..e430dbb 100644 --- a/src/ui/default.rs +++ b/src/ui/default.rs @@ -54,10 +54,7 @@ impl std::iter::Iterator for State { impl Ui { pub fn run(opt: &Opt) { - let repo_id = match &opt.repo { - None => None, - Some(repo) => Some(String::as_str(repo)), - }; + let repo_id = opt.repo.as_ref().map(|repo| String::as_str(repo)); let mut ui = Ui { state: State::SelectService, diff --git a/src/ui/no_yaml.rs b/src/ui/no_yaml.rs index 99bb46b..6e1c630 100644 --- a/src/ui/no_yaml.rs +++ b/src/ui/no_yaml.rs @@ -49,10 +49,7 @@ pub struct NoYaml { impl NoYaml { pub fn run(opt: &Opt) { - let repo_id = match &opt.repo { - None => None, - Some(repo) => Some(String::as_str(repo)), - }; + let repo_id = opt.repo.as_ref().map(|repo| String::as_str(repo)); let mut ui = NoYaml { state: State::EditRepo, diff --git a/src/widget/repo_entry.rs b/src/widget/repo_entry.rs index f3099e4..14f9828 100644 --- a/src/widget/repo_entry.rs +++ b/src/widget/repo_entry.rs @@ -64,11 +64,10 @@ impl RepoEntry { Key::Backspace => { if self.default_text { self.text = String::new(); - self.changed = true; } else { self.text.pop(); - self.changed = true; } + self.changed = true; } Key::Esc => { self.text = self.old_text.clone();