diff --git a/cursive/src/main.rs b/cursive/src/main.rs index a626634..8b9861d 100644 --- a/cursive/src/main.rs +++ b/cursive/src/main.rs @@ -1312,10 +1312,10 @@ fn get_translation_catalog() -> gettext::Catalog { if let Ok(langid) = langid_res { let file = std::fs::File::open(format!("{}/{}.mo", loc, langid.language)); - if let Ok(file) = file { - if let Ok(catalog) = gettext::Catalog::parse(file) { - return catalog; - } + if let Ok(file) = file + && let Ok(catalog) = gettext::Catalog::parse(file) + { + return catalog; } } } @@ -1329,10 +1329,10 @@ fn get_translation_catalog() -> gettext::Catalog { "/usr/share/locale/{}/LC_MESSAGES/ripasso-cursive.mo", langid.language )); - if let Ok(file) = file { - if let Ok(catalog) = gettext::Catalog::parse(file) { - return catalog; - } + if let Ok(file) = file + && let Ok(catalog) = gettext::Catalog::parse(file) + { + return catalog; } } } diff --git a/gtk/src/collection_object/mod.rs b/gtk/src/collection_object/mod.rs index 8e98560..f4adfb3 100644 --- a/gtk/src/collection_object/mod.rs +++ b/gtk/src/collection_object/mod.rs @@ -29,7 +29,7 @@ impl CollectionObject { store: Arc>, user_config_dir: &Path, ) -> Self { - let co = Object::builder() + Object::builder() .property("title", title) .property("passwords", passwords) .property("store", PasswordStoreBoxed(store)) @@ -39,9 +39,7 @@ impl CollectionObject { .to_str() .expect("can't have non-utf8 in path"), ) - .build(); - - co + .build() } pub fn passwords(&self) -> gio::ListStore { diff --git a/src/crypto.rs b/src/crypto.rs index 5b48c61..0eb2959 100644 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -477,10 +477,10 @@ impl VerificationHelper for Helper<'_> { } for layer in structure { - if let MessageLayer::SignatureGroup { results } = layer { - if results.iter().any(std::result::Result::is_ok) { - return Ok(()); - } + if let MessageLayer::SignatureGroup { results } = layer + && results.iter().any(std::result::Result::is_ok) + { + return Ok(()); } } Err(anyhow::anyhow!("No valid signature")) diff --git a/src/git.rs b/src/git.rs index 78641c8..b6c3d2d 100644 --- a/src/git.rs +++ b/src/git.rs @@ -75,7 +75,7 @@ pub fn commit( } } -pub fn find_last_commit(repo: &Repository) -> Result { +pub fn find_last_commit(repo: &Repository) -> Result> { let obj = repo.head()?.resolve()?.peel(git2::ObjectType::Commit)?; obj.into_commit() .map_err(|_| Error::Generic("Couldn't find commit")) @@ -205,7 +205,7 @@ pub fn move_and_commit( /// find the origin of the git repo, with the following strategy: /// find the branch that HEAD points to, and read the remote configured for that branch /// returns the remote and the name of the local branch -fn find_origin(repo: &Repository) -> Result<(git2::Remote, String)> { +fn find_origin(repo: &Repository) -> Result<(git2::Remote<'_>, String)> { for branch in repo.branches(Some(git2::BranchType::Local))? { let b = branch?.0; if b.is_head() { diff --git a/src/pass.rs b/src/pass.rs index d04a412..81fdc0d 100644 --- a/src/pass.rs +++ b/src/pass.rs @@ -355,12 +355,12 @@ impl PasswordStore { if path_iter.peek().is_some() { path.push(p); let c_file_res = fs::canonicalize(path.as_path()); - if let Ok(c_file) = c_file_res { - if !c_file.starts_with(c_path.as_path()) { - return Err(Error::Generic( - "trying to write outside of password store directory", - )); - } + if let Ok(c_file) = c_file_res + && !c_file.starts_with(c_path.as_path()) + { + return Err(Error::Generic( + "trying to write outside of password store directory", + )); } if !path.exists() { fs::create_dir(&path)?; @@ -452,12 +452,12 @@ impl PasswordStore { return true; } - if let Ok(repo) = self.repo() { - if let Ok(config) = repo.config() { - let user_name = config.get_string("user.name"); - if user_name.is_ok() { - return true; - } + if let Ok(repo) = self.repo() + && let Ok(config) = repo.config() + { + let user_name = config.get_string("user.name"); + if user_name.is_ok() { + return true; } }