Skip to content

Commit 866dffa

Browse files
committed
Code style improvements.
1 parent 3138e8e commit 866dffa

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

src/rust/src/x509/verify.rs

+13-21
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ pub(crate) struct PolicyBuilder {
7979
}
8080

8181
impl PolicyBuilder {
82-
/// Clones the builder, requires the GIL token to increase
83-
/// reference count for `self.store`.
8482
fn py_clone(&self, py: pyo3::Python<'_>) -> PolicyBuilder {
8583
PolicyBuilder {
8684
time: self.time.clone(),
@@ -313,26 +311,20 @@ impl PyClientVerifier {
313311
py_chain.append(c.extra())?;
314312
}
315313

316-
let subjects = {
317-
// NOTE: The `unwrap()` cannot fail, since the underlying policy
318-
// enforces the well-formedness of the extension set.
319-
let leaf_san_ext = &chain[0]
320-
.certificate()
321-
.extensions()
322-
.ok()
323-
.unwrap()
324-
.get_extension(&SUBJECT_ALTERNATIVE_NAME_OID);
325-
326-
match leaf_san_ext {
327-
None => None,
328-
Some(leaf_san) => {
329-
let leaf_gns = leaf_san
330-
.value::<SubjectAlternativeName<'_>>()
331-
.map_err(|e| -> CryptographyError { e.into() })?;
332-
let py_gns = parse_general_names(py, &leaf_gns)?;
333-
Some(py_gns)
334-
}
314+
// NOTE: The `unwrap()` cannot fail, since the underlying policy
315+
// enforces the well-formedness of the extension set.
316+
let subjects = match &chain[0]
317+
.certificate()
318+
.extensions()
319+
.ok()
320+
.unwrap()
321+
.get_extension(&SUBJECT_ALTERNATIVE_NAME_OID)
322+
{
323+
Some(leaf_san) => {
324+
let leaf_gns = leaf_san.value::<SubjectAlternativeName<'_>>()?;
325+
Some(parse_general_names(py, &leaf_gns)?)
335326
}
327+
None => None,
336328
};
337329

338330
Ok(PyVerifiedClient {

0 commit comments

Comments
 (0)