aboutsummaryrefslogtreecommitdiff
path: root/src/rust
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2018-06-24 10:27:46 -0400
committerCorey Farwell <coreyf@rwell.org>2018-06-24 22:44:36 -0400
commit59d4505749073f45db9a32d606b760eb9e07df69 (patch)
treed46eabf8298582a689f3671dc2f2d7bec1dfa44c /src/rust
parent94880b2db73d514e0352d70be8eda2b36132aa4d (diff)
downloadtor-59d4505749073f45db9a32d606b760eb9e07df69.tar.gz
tor-59d4505749073f45db9a32d606b760eb9e07df69.zip
Utilize `if..else` for switching on boolean values.
Diffstat (limited to 'src/rust')
-rw-r--r--src/rust/protover/ffi.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index f668dba80b..ba156cb1ba 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -105,9 +105,10 @@ pub extern "C" fn protocol_list_supports_protocol(
Ok(n) => n.into(),
Err(_) => return 0,
};
- match proto_entry.supports_protocol(&protocol, &version) {
- false => return 0,
- true => return 1,
+ if proto_entry.supports_protocol(&protocol, &version) {
+ 1
+ } else {
+ 0
}
}
@@ -206,13 +207,16 @@ pub extern "C" fn protover_compute_vote(
let mut proto_entries: Vec<UnvalidatedProtoEntry> = Vec::new();
for datum in data {
- let entry: UnvalidatedProtoEntry = match allow_long_proto_names {
- true => match UnvalidatedProtoEntry::from_str_any_len(datum.as_str()) {
+ let entry: UnvalidatedProtoEntry = if allow_long_proto_names {
+ match UnvalidatedProtoEntry::from_str_any_len(datum.as_str()) {
Ok(n) => n,
- Err(_) => continue},
- false => match datum.parse() {
+ Err(_) => continue
+ }
+ } else {
+ match datum.parse() {
Ok(n) => n,
- Err(_) => continue},
+ Err(_) => continue
+ }
};
proto_entries.push(entry);
}