]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Utilize `if let` construct instead of explicit unwrapping.
authorCorey Farwell <coreyf@rwell.org>
Sun, 24 Jun 2018 14:16:11 +0000 (10:16 -0400)
committerCorey Farwell <coreyf@rwell.org>
Sun, 24 Jun 2018 14:16:11 +0000 (10:16 -0400)
src/rust/protover/ffi.rs

index 0470cd487a7ccc0b4dfc66a24dca7ffc6de59af1..f668dba80bd0e0953d3f7f53c18dc7c33cd19962 100644 (file)
@@ -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,