Commit 1aff5b91 authored by Jacob Hoffman-Andrews's avatar Jacob Hoffman-Andrews
Browse files

Fixes in response to review feedback.

parent 6482f419
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -67,15 +67,17 @@ foreign_type_and_impl_send_sync! {
impl fmt::Display for Asn1GeneralizedTimeRef {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        unsafe {
            match MemBio::new() {
                Err(_) => f.write_str(""),
                Ok(mem_bio) => match cvt(ffi::ASN1_GENERALIZEDTIME_print(
            let mem_bio = match MemBio::new() {
                Err(_) => return f.write_str(""),
                Ok(m) => m,
            };
            let print_result = cvt(ffi::ASN1_GENERALIZEDTIME_print(
                mem_bio.as_ptr(),
                self.as_ptr(),
                )) {
            ));
            match print_result {
                Err(_) => f.write_str(""),
                Ok(_) => f.write_str(str::from_utf8_unchecked(mem_bio.get_buf())),
                },
            }
        }
    }
@@ -211,12 +213,14 @@ impl<'a> PartialOrd<Asn1Time> for &'a Asn1TimeRef {
impl fmt::Display for Asn1TimeRef {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        unsafe {
            match MemBio::new() {
                Err(_) => f.write_str("error"),
                Ok(mem_bio) => match cvt(ffi::ASN1_TIME_print(mem_bio.as_ptr(), self.as_ptr())) {
            let mem_bio = match MemBio::new() {
                Err(_) => return f.write_str("error"),
                Ok(m) => m,
            };
            let print_result = cvt(ffi::ASN1_TIME_print(mem_bio.as_ptr(), self.as_ptr()));
            match print_result {
                Err(_) => f.write_str("error"),
                Ok(_) => f.write_str(str::from_utf8_unchecked(mem_bio.get_buf())),
                },
            }
        }
    }
+1 −3
Original line number Diff line number Diff line
@@ -301,9 +301,7 @@ impl<T> fmt::Debug for PKey<T> {
            Id::ED448 => "Ed448",
            _ => "unknown",
        };
        fmt.debug_struct("public_key")
            .field("algorithm", &alg)
            .finish()
        fmt.debug_struct("PKey").field("algorithm", &alg).finish()
        // TODO: Print details for each specific type of key
    }
}
+9 −11
Original line number Diff line number Diff line
@@ -1342,19 +1342,17 @@ impl GeneralNameRef {
impl fmt::Debug for GeneralNameRef {
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        if let Some(email) = self.email() {
            return formatter.write_str(email);
        }
        if let Some(dnsname) = self.dnsname() {
            return formatter.write_str(dnsname);
        }
        if let Some(uri) = self.uri() {
            return formatter.write_str(uri);
        }
        if let Some(ipaddress) = self.ipaddress() {
            formatter.write_str(email)
        } else if let Some(dnsname) = self.dnsname() {
            formatter.write_str(dnsname)
        } else if let Some(uri) = self.uri() {
            formatter.write_str(uri)
        } else if let Some(ipaddress) = self.ipaddress() {
            let result = String::from_utf8_lossy(ipaddress);
            return formatter.write_str(&result);
            formatter.write_str(&result)
        } else {
            formatter.write_str("(empty)")
        }
        Ok(())
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ fn test_debug() {
    ],
    not_before: Aug 14 17:00:03 2016 GMT,
    not_after: Aug 12 17:00:03 2026 GMT,
    public_key: public_key {
    public_key: PKey {
        algorithm: "RSA",
    },
}"#;