summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-12-04 22:44:41 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-12-04 22:44:41 +0100
commit39678f83206d92905cb401643d7b78a06131c398 (patch)
tree1cf3310ae9fe4c38c39708b395960e096836be8a
parent91559382f141351f2294b093894df043d05a780d (diff)
parent28d6730ed845628b7283e29515bec63128c6d7d0 (diff)
downloadmullvadvpn-39678f83206d92905cb401643d7b78a06131c398.tar.xz
mullvadvpn-39678f83206d92905cb401643d7b78a06131c398.zip
Merge branch 'clippy-cleanup'
-rw-r--r--mullvad-cli/src/cmds/tunnel.rs10
-rw-r--r--talpid-core/src/network_interface.rs2
-rw-r--r--talpid-core/src/routing/linux.rs7
-rw-r--r--talpid-core/src/routing/macos.rs2
-rw-r--r--talpid-core/src/routing/subprocess.rs2
5 files changed, 11 insertions, 12 deletions
diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs
index 55cb26ed54..7a45f5274f 100644
--- a/mullvad-cli/src/cmds/tunnel.rs
+++ b/mullvad-cli/src/cmds/tunnel.rs
@@ -139,9 +139,9 @@ impl Tunnel {
}
fn handle_openvpn_mssfix_cmd(matches: &clap::ArgMatches) -> Result<()> {
- if let Some(_) = matches.subcommand_matches("get") {
+ if matches.subcommand_matches("get").is_some() {
Self::process_openvpn_mssfix_get()
- } else if let Some(_) = matches.subcommand_matches("unset") {
+ } else if matches.subcommand_matches("unset").is_some() {
Self::process_openvpn_mssfix_unset()
} else if let Some(m) = matches.subcommand_matches("set") {
Self::process_openvpn_mssfix_set(m)
@@ -151,9 +151,9 @@ impl Tunnel {
}
fn handle_openvpn_proxy_cmd(matches: &clap::ArgMatches) -> Result<()> {
- if let Some(_) = matches.subcommand_matches("get") {
+ if matches.subcommand_matches("get").is_some() {
Self::process_openvpn_proxy_get()
- } else if let Some(_) = matches.subcommand_matches("unset") {
+ } else if matches.subcommand_matches("unset").is_some() {
Self::process_openvpn_proxy_unset()
} else if let Some(m) = matches.subcommand_matches("set") {
Self::process_openvpn_proxy_set(m)
@@ -163,7 +163,7 @@ impl Tunnel {
}
fn handle_ipv6_cmd(matches: &clap::ArgMatches) -> Result<()> {
- if let Some(_) = matches.subcommand_matches("get") {
+ if matches.subcommand_matches("get").is_some() {
Self::process_ipv6_get()
} else if let Some(m) = matches.subcommand_matches("set") {
Self::process_ipv6_set(m)
diff --git a/talpid-core/src/network_interface.rs b/talpid-core/src/network_interface.rs
index 4a2cd21f93..0bdc23072e 100644
--- a/talpid-core/src/network_interface.rs
+++ b/talpid-core/src/network_interface.rs
@@ -123,7 +123,7 @@ impl NetworkInterface for TunnelDevice {
fn set_mtu(&mut self, mtu: u16) -> Result<()> {
self.dev
- .set_mtu(mtu as i32)
+ .set_mtu(i32::from(mtu))
.chain_err(|| ErrorKind::ToggleDeviceError)
}
diff --git a/talpid-core/src/routing/linux.rs b/talpid-core/src/routing/linux.rs
index 9f33c9401d..e45c469c57 100644
--- a/talpid-core/src/routing/linux.rs
+++ b/talpid-core/src/routing/linux.rs
@@ -142,7 +142,7 @@ impl RouteManager {
cmd = cmd.arg("table").arg(fwmark);
}
- cmd.to_expr()
+ cmd.into_expr()
.run_expr()
.chain_err(|| ErrorKind::FailedToAddRoute)?;
@@ -289,9 +289,8 @@ impl super::RoutingT for RouteManager {
let ip_str: &str = output
.lines()
.find(|line| line.trim().starts_with("default via "))
- .and_then(|line| line.trim().split_whitespace().skip(2).next())
- .map(Ok)
- .unwrap_or(Err(Error::from(ErrorKind::FailedToGetDefaultRoute)))?;
+ .and_then(|line| line.trim().split_whitespace().nth(2))
+ .ok_or_else(|| Error::from(ErrorKind::FailedToGetDefaultRoute))?;
ip_str
.parse()
diff --git a/talpid-core/src/routing/macos.rs b/talpid-core/src/routing/macos.rs
index 7663ad1bd8..6928084273 100644
--- a/talpid-core/src/routing/macos.rs
+++ b/talpid-core/src/routing/macos.rs
@@ -50,7 +50,7 @@ impl RouteManager {
NetNode::Device(device) => cmd.arg("-interface").arg(&device),
};
- cmd.to_expr()
+ cmd.into_expr()
.run_expr()
.chain_err(|| ErrorKind::FailedToAddRoute)?;
self.set_routes.insert(route);
diff --git a/talpid-core/src/routing/subprocess.rs b/talpid-core/src/routing/subprocess.rs
index d569f0191b..8b6292c1b4 100644
--- a/talpid-core/src/routing/subprocess.rs
+++ b/talpid-core/src/routing/subprocess.rs
@@ -40,7 +40,7 @@ impl Exec {
self
}
- pub fn to_expr(self) -> Expression {
+ pub fn into_expr(self) -> Expression {
duct::cmd(self.cmd, self.args)
}
}