Skip to content

Commit

Permalink
verification: fix unnecessary lazy evaluations findings
Browse files Browse the repository at this point in the history
Clippy is flagging a couple instances of this:
```
error: unnecessary closure used with `bool::then`
   --> src/verification/android.rs:251:18
    |
251 |         .map(|o| (!o.is_null()).then(|| o))
    |                  ^^^^^^^^^^^^^^^----------
    |                                 |
    |                                 help: use `then_some(..)` instead: `then_some(o)`
    |
```

This commit applies the recommended fix.
  • Loading branch information
cpu committed Sep 7, 2023
1 parent 599c345 commit e16c06e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/verification/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fn extract_result_info(env: &JNIEnv<'_>, result: JObject<'_>) -> (VerifierStatus
let msg = env
.get_field(result, "message", "Ljava/lang/String;")
.and_then(|m| m.l())
.map(|o| (!o.is_null()).then(|| o))
.map(|o| (!o.is_null()).then_some(o))
.and_then(|s| s.map(|s| JavaStr::from_env(env, s.into())).transpose())
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/verification/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Certificate {
CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG,
prop_data,
) == TRUE)
.then(|| ())
.then_some(())
})
}
}
Expand Down

0 comments on commit e16c06e

Please sign in to comment.