From 6c83683a4a67fd55556f685ecc6f45cb70a40486 Mon Sep 17 00:00:00 2001 From: Thomas Eppers Date: Thu, 25 Nov 2021 17:10:29 +0100 Subject: [PATCH] fixed clippy warnings --- src/ui/default.rs | 5 +---- src/ui/no_yaml.rs | 5 +---- src/widget/repo_entry.rs | 3 +-- 3 files changed, 3 insertions(+), 10 deletions(-) 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();