summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2021-12-16 13:20:34 +0100
committerLinus Färnstrand <linus@mullvad.net>2021-12-16 15:18:07 +0100
commitfdde554f9bd5d617a7415ec8c8543b592407999f (patch)
tree465e559055ecdd06786c0cc9d69bdd78b7c03a5a
parent13f1ec7a6135c33bb60e39641de61657b6c7ba6a (diff)
downloadmullvadvpn-fdde554f9bd5d617a7415ec8c8543b592407999f.tar.xz
mullvadvpn-fdde554f9bd5d617a7415ec8c8543b592407999f.zip
Tiny simplification/code cleanup
-rw-r--r--talpid-core/src/firewall/macos.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/talpid-core/src/firewall/macos.rs b/talpid-core/src/firewall/macos.rs
index de78524249..b8672a1f92 100644
--- a/talpid-core/src/firewall/macos.rs
+++ b/talpid-core/src/firewall/macos.rs
@@ -54,14 +54,12 @@ impl FirewallT for Firewall {
}
fn reset_policy(&mut self) -> Result<()> {
- vec![
- self.remove_rules(),
- self.remove_anchor(),
- self.restore_state(),
- ]
- .into_iter()
- .collect::<Result<Vec<_>>>()
- .map(|_| ())
+ // Implemented this way to not early return on an error.
+ // We always want all three methods to run, and then return
+ // the first error it encounterd, if any.
+ self.remove_rules()
+ .and(self.remove_anchor())
+ .and(self.restore_state())
}
}