From 63b1ec1a12847c3361a11e33f4836b16c4b87cde Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 26 Oct 2016 22:13:10 -0700 Subject: [PATCH] Stop returning an Option from cipher description --- openssl/src/ssl/mod.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index b6f24529..f2224b1e 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -784,17 +784,12 @@ impl SslCipherRef { } /// Returns a textual description of the cipher used - pub fn description(&self) -> Option { + pub fn description(&self) -> String { unsafe { // SSL_CIPHER_description requires a buffer of at least 128 bytes. let mut buf = [0; 128]; - let desc_ptr = ffi::SSL_CIPHER_description(self.as_ptr(), buf.as_mut_ptr(), 128); - - if !desc_ptr.is_null() { - String::from_utf8(CStr::from_ptr(desc_ptr as *const _).to_bytes().to_vec()).ok() - } else { - None - } + ffi::SSL_CIPHER_description(self.as_ptr(), buf.as_mut_ptr(), 128); + String::from_utf8(CStr::from_ptr(buf.as_ptr() as *const _).to_bytes().to_vec()).unwrap() } } }