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

[tor-commits] [tor/master] Run rustfmt on 'src/rust/protover/ffi.rs'.



commit e62582e9fe67d742d5d422758fe588d22e8599f7
Author: Corey Farwell <coreyf@xxxxxxxxx>
Date:   Sun Jun 24 22:56:58 2018 -0400

    Run rustfmt on 'src/rust/protover/ffi.rs'.
---
 src/rust/protover/ffi.rs | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index 40a7354cb..034f16e22 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -42,7 +42,6 @@ pub extern "C" fn protover_all_supported(
     c_relay_version: *const c_char,
     missing_out: *mut *mut c_char,
 ) -> c_int {
-
     if c_relay_version.is_null() {
         return 1;
     }
@@ -58,12 +57,13 @@ pub extern "C" fn protover_all_supported(
 
     let relay_proto_entry: UnvalidatedProtoEntry =
         match UnvalidatedProtoEntry::from_str_any_len(relay_version) {
-        Ok(n)  => n,
-        Err(_) => return 1,
-    };
+            Ok(n) => n,
+            Err(_) => return 1,
+        };
 
     if let Some(unsupported) = relay_proto_entry.all_supported() {
-        let c_unsupported: CString = match CString::new(unsupported.to_string()) {
+        let c_unsupported: CString = match CString::new(unsupported.to_string())
+        {
             Ok(n) => n,
             Err(_) => return 1,
         };
@@ -98,7 +98,7 @@ pub extern "C" fn protocol_list_supports_protocol(
         Err(_) => return 1,
     };
     let proto_entry: UnvalidatedProtoEntry = match protocol_list.parse() {
-        Ok(n)  => n,
+        Ok(n) => n,
         Err(_) => return 0,
     };
     let protocol: UnknownProtocol = match translate_to_rust(c_protocol) {
@@ -114,7 +114,7 @@ pub extern "C" fn protocol_list_supports_protocol(
 
 #[no_mangle]
 pub extern "C" fn protover_contains_long_protocol_names_(
-    c_protocol_list: *const c_char
+    c_protocol_list: *const c_char,
 ) -> c_int {
     if c_protocol_list.is_null() {
         return 1;
@@ -126,7 +126,7 @@ pub extern "C" fn protover_contains_long_protocol_names_(
 
     let protocol_list = match c_str.to_str() {
         Ok(n) => n,
-        Err(_) => return 1
+        Err(_) => return 1,
     };
 
     match protocol_list.parse::<UnvalidatedProtoEntry>() {
@@ -162,7 +162,7 @@ pub extern "C" fn protocol_list_supports_protocol_or_later(
     };
 
     let proto_entry: UnvalidatedProtoEntry = match protocol_list.parse() {
-        Ok(n)  => n,
+        Ok(n) => n,
         Err(_) => return 1,
     };
 
@@ -192,7 +192,6 @@ pub extern "C" fn protover_compute_vote(
     threshold: c_int,
     allow_long_proto_names: bool,
 ) -> *mut c_char {
-
     if list.is_null() {
         return allocate_and_copy_string("");
     }
@@ -206,18 +205,19 @@ pub extern "C" fn protover_compute_vote(
     for datum in data {
         let entry: UnvalidatedProtoEntry = if allow_long_proto_names {
             match UnvalidatedProtoEntry::from_str_any_len(datum.as_str()) {
-                Ok(n)  => n,
-                Err(_) => continue
+                Ok(n) => n,
+                Err(_) => continue,
             }
         } else {
             match datum.parse() {
-                Ok(n)  => n,
-                Err(_) => continue
+                Ok(n) => n,
+                Err(_) => continue,
             }
         };
         proto_entries.push(entry);
     }
-    let vote: UnvalidatedProtoEntry = ProtoverVote::compute(&proto_entries, &hold);
+    let vote: UnvalidatedProtoEntry =
+        ProtoverVote::compute(&proto_entries, &hold);
 
     allocate_and_copy_string(&vote.to_string())
 }
@@ -242,7 +242,9 @@ pub extern "C" fn protover_is_supported_here(
 /// Provide an interface for C to translate arguments and return types for
 /// protover::compute_for_old_tor
 #[no_mangle]
-pub extern "C" fn protover_compute_for_old_tor(version: *const c_char) -> *const c_char {
+pub extern "C" fn protover_compute_for_old_tor(
+    version: *const c_char,
+) -> *const c_char {
     let supported: &'static CStr;
     let empty: &'static CStr;
 



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