summaryrefslogtreecommitdiff
path: root/openssl/src/asn1.rs
diff options
context:
space:
mode:
authorjohnthagen <johnthagen@gmail.com>2017-10-03 17:44:02 -0400
committerjohnthagen <johnthagen@gmail.com>2017-10-03 17:44:02 -0400
commitb5bb8de4f2bd18735346a6062a13d95bcf82bdee (patch)
tree11a6f6d11bc412fc89a4bfb3517ced56bf047012 /openssl/src/asn1.rs
parent7159215e45b8ddd7d423f9fd2b8c37a4cbb90563 (diff)
downloadrust-openssl-b5bb8de4f2bd18735346a6062a13d95bcf82bdee.zip
Convert try! usage to ?
Diffstat (limited to 'openssl/src/asn1.rs')
-rw-r--r--openssl/src/asn1.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs
index b9f1df71..27913aa6 100644
--- a/openssl/src/asn1.rs
+++ b/openssl/src/asn1.rs
@@ -63,11 +63,11 @@ foreign_type! {
impl fmt::Display for Asn1GeneralizedTimeRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe {
- let mem_bio = try!(MemBio::new());
- try!(cvt(ffi::ASN1_GENERALIZEDTIME_print(
+ let mem_bio = MemBio::new()?;
+ cvt(ffi::ASN1_GENERALIZEDTIME_print(
mem_bio.as_ptr(),
self.as_ptr(),
- )));
+ ))?;
write!(f, "{}", str::from_utf8_unchecked(mem_bio.get_buf()))
}
}
@@ -96,8 +96,8 @@ foreign_type! {
impl fmt::Display for Asn1TimeRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe {
- let mem_bio = try!(MemBio::new());
- try!(cvt(ffi::ASN1_TIME_print(mem_bio.as_ptr(), self.as_ptr())));
+ let mem_bio = MemBio::new()?;
+ cvt(ffi::ASN1_TIME_print(mem_bio.as_ptr(), self.as_ptr()))?;
write!(f, "{}", str::from_utf8_unchecked(mem_bio.get_buf()))
}
}
@@ -108,7 +108,7 @@ impl Asn1Time {
ffi::init();
unsafe {
- let handle = try!(cvt_p(ffi::X509_gmtime_adj(ptr::null_mut(), period)));
+ let handle = cvt_p(ffi::X509_gmtime_adj(ptr::null_mut(), period))?;
Ok(Asn1Time::from_ptr(handle))
}
}
@@ -279,7 +279,7 @@ impl fmt::Display for Asn1ObjectRef {
self.as_ptr(),
0,
);
- let s = try!(str::from_utf8(&buf[..len as usize]).map_err(|_| fmt::Error));
+ let s = str::from_utf8(&buf[..len as usize]).map_err(|_| fmt::Error)?;
fmt.write_str(s)
}
}