Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cursive/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand All @@ -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;
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions gtk/src/collection_object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl CollectionObject {
store: Arc<Mutex<PasswordStore>>,
user_config_dir: &Path,
) -> Self {
let co = Object::builder()
Object::builder()
.property("title", title)
.property("passwords", passwords)
.property("store", PasswordStoreBoxed(store))
Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
4 changes: 2 additions & 2 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn commit(
}
}

pub fn find_last_commit(repo: &Repository) -> Result<git2::Commit> {
pub fn find_last_commit(repo: &Repository) -> Result<git2::Commit<'_>> {
let obj = repo.head()?.resolve()?.peel(git2::ObjectType::Commit)?;
obj.into_commit()
.map_err(|_| Error::Generic("Couldn't find commit"))
Expand Down Expand Up @@ -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() {
Expand Down
24 changes: 12 additions & 12 deletions src/pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down Expand Up @@ -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;
}
}

Expand Down
Loading