[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Utilize `if let` construct instead of explicit unwrapping.



commit 94880b2db73d514e0352d70be8eda2b36132aa4d
Author: Corey Farwell <coreyf@xxxxxxxxx>
Date:   Sun Jun 24 10:16:11 2018 -0400

    Utilize `if let` construct instead of explicit unwrapping.
---
 src/rust/protover/ffi.rs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index 0470cd487..f668dba80 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -61,10 +61,8 @@ pub extern "C" fn protover_all_supported(
         Ok(n)  => n,
         Err(_) => return 1,
     };
-    let maybe_unsupported: Option<UnvalidatedProtoEntry> = relay_proto_entry.all_supported();
 
-    if maybe_unsupported.is_some() {
-        let unsupported: UnvalidatedProtoEntry = maybe_unsupported.unwrap();
+    if let Some(unsupported) = relay_proto_entry.all_supported() {
         let c_unsupported: CString = match CString::new(unsupported.to_string()) {
             Ok(n) => n,
             Err(_) => return 1,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits