Skip to content

Commit e14188a

Browse files
Merge pull request #389 from cortex/clippy-1.89-fixes
clippy fixes
2 parents eb4ceff + 9abd447 commit e14188a

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

cursive/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,10 @@ fn get_translation_catalog() -> gettext::Catalog {
13121312

13131313
if let Ok(langid) = langid_res {
13141314
let file = std::fs::File::open(format!("{}/{}.mo", loc, langid.language));
1315-
if let Ok(file) = file {
1316-
if let Ok(catalog) = gettext::Catalog::parse(file) {
1317-
return catalog;
1318-
}
1315+
if let Ok(file) = file
1316+
&& let Ok(catalog) = gettext::Catalog::parse(file)
1317+
{
1318+
return catalog;
13191319
}
13201320
}
13211321
}
@@ -1329,10 +1329,10 @@ fn get_translation_catalog() -> gettext::Catalog {
13291329
"/usr/share/locale/{}/LC_MESSAGES/ripasso-cursive.mo",
13301330
langid.language
13311331
));
1332-
if let Ok(file) = file {
1333-
if let Ok(catalog) = gettext::Catalog::parse(file) {
1334-
return catalog;
1335-
}
1332+
if let Ok(file) = file
1333+
&& let Ok(catalog) = gettext::Catalog::parse(file)
1334+
{
1335+
return catalog;
13361336
}
13371337
}
13381338
}

gtk/src/collection_object/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl CollectionObject {
2929
store: Arc<Mutex<PasswordStore>>,
3030
user_config_dir: &Path,
3131
) -> Self {
32-
let co = Object::builder()
32+
Object::builder()
3333
.property("title", title)
3434
.property("passwords", passwords)
3535
.property("store", PasswordStoreBoxed(store))
@@ -39,9 +39,7 @@ impl CollectionObject {
3939
.to_str()
4040
.expect("can't have non-utf8 in path"),
4141
)
42-
.build();
43-
44-
co
42+
.build()
4543
}
4644

4745
pub fn passwords(&self) -> gio::ListStore {

src/crypto.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ impl VerificationHelper for Helper<'_> {
477477
}
478478

479479
for layer in structure {
480-
if let MessageLayer::SignatureGroup { results } = layer {
481-
if results.iter().any(std::result::Result::is_ok) {
482-
return Ok(());
483-
}
480+
if let MessageLayer::SignatureGroup { results } = layer
481+
&& results.iter().any(std::result::Result::is_ok)
482+
{
483+
return Ok(());
484484
}
485485
}
486486
Err(anyhow::anyhow!("No valid signature"))

src/git.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub fn commit(
7575
}
7676
}
7777

78-
pub fn find_last_commit(repo: &Repository) -> Result<git2::Commit> {
78+
pub fn find_last_commit(repo: &Repository) -> Result<git2::Commit<'_>> {
7979
let obj = repo.head()?.resolve()?.peel(git2::ObjectType::Commit)?;
8080
obj.into_commit()
8181
.map_err(|_| Error::Generic("Couldn't find commit"))
@@ -205,7 +205,7 @@ pub fn move_and_commit(
205205
/// find the origin of the git repo, with the following strategy:
206206
/// find the branch that HEAD points to, and read the remote configured for that branch
207207
/// returns the remote and the name of the local branch
208-
fn find_origin(repo: &Repository) -> Result<(git2::Remote, String)> {
208+
fn find_origin(repo: &Repository) -> Result<(git2::Remote<'_>, String)> {
209209
for branch in repo.branches(Some(git2::BranchType::Local))? {
210210
let b = branch?.0;
211211
if b.is_head() {

src/pass.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ impl PasswordStore {
355355
if path_iter.peek().is_some() {
356356
path.push(p);
357357
let c_file_res = fs::canonicalize(path.as_path());
358-
if let Ok(c_file) = c_file_res {
359-
if !c_file.starts_with(c_path.as_path()) {
360-
return Err(Error::Generic(
361-
"trying to write outside of password store directory",
362-
));
363-
}
358+
if let Ok(c_file) = c_file_res
359+
&& !c_file.starts_with(c_path.as_path())
360+
{
361+
return Err(Error::Generic(
362+
"trying to write outside of password store directory",
363+
));
364364
}
365365
if !path.exists() {
366366
fs::create_dir(&path)?;
@@ -452,12 +452,12 @@ impl PasswordStore {
452452
return true;
453453
}
454454

455-
if let Ok(repo) = self.repo() {
456-
if let Ok(config) = repo.config() {
457-
let user_name = config.get_string("user.name");
458-
if user_name.is_ok() {
459-
return true;
460-
}
455+
if let Ok(repo) = self.repo()
456+
&& let Ok(config) = repo.config()
457+
{
458+
let user_name = config.get_string("user.name");
459+
if user_name.is_ok() {
460+
return true;
461461
}
462462
}
463463

0 commit comments

Comments
 (0)