summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-09-27 15:36:13 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-09-27 15:36:13 +0200
commite830dad2b1e00a2ef46382dfe71c80b0406686e8 (patch)
treeeb7db04951974780a61c0c4ad948c5e1c3b360fa
parent00b0ba04092e97f3724260b943f3b138e8eb7b01 (diff)
parent763d5e200947d616865ec3292c27347739d2d386 (diff)
downloadmullvadvpn-e830dad2b1e00a2ef46382dfe71c80b0406686e8.tar.xz
mullvadvpn-e830dad2b1e00a2ef46382dfe71c80b0406686e8.zip
Merge branch 'update-rustfmt'
-rw-r--r--mullvad-cli/src/cmds/account.rs6
-rw-r--r--mullvad-cli/src/cmds/auto_connect.rs3
-rw-r--r--mullvad-cli/src/cmds/lan.rs3
-rw-r--r--mullvad-cli/src/cmds/relay.rs39
-rw-r--r--mullvad-cli/src/cmds/tunnel.rs18
-rw-r--r--mullvad-daemon/src/lib.rs6
-rw-r--r--mullvad-daemon/src/main.rs6
-rw-r--r--mullvad-daemon/src/management_interface.rs3
-rw-r--r--mullvad-daemon/src/relays.rs3
-rw-r--r--mullvad-daemon/src/shutdown.rs3
-rw-r--r--mullvad-ipc-client/src/lib.rs3
-rw-r--r--mullvad-problem-report/src/main.rs27
-rw-r--r--mullvad-rpc/src/rest.rs3
-rw-r--r--mullvad-tests/src/lib.rs21
-rw-r--r--mullvad-types/src/custom_tunnel.rs3
-rw-r--r--talpid-core/src/security/macos/dns.rs97
-rw-r--r--talpid-core/src/security/macos/mod.rs9
-rw-r--r--talpid-core/src/security/windows/dns.rs3
-rw-r--r--talpid-core/src/security/windows/mod.rs6
-rw-r--r--talpid-core/src/tunnel/mod.rs6
-rw-r--r--talpid-core/src/tunnel/openvpn.rs22
-rw-r--r--talpid-ipc/src/lib.rs3
22 files changed, 178 insertions, 115 deletions
diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs
index 4d42c8c226..1beee454c7 100644
--- a/mullvad-cli/src/cmds/account.rs
+++ b/mullvad-cli/src/cmds/account.rs
@@ -22,10 +22,12 @@ impl Command for Account {
.help("The Mullvad account token to configure the client with")
.required(true),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("get")
.about("Display information about the currently configured account"),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("unset")
.about("Removes the account number from the settings"),
)
diff --git a/mullvad-cli/src/cmds/auto_connect.rs b/mullvad-cli/src/cmds/auto_connect.rs
index 7117c0f2aa..5d043f0f9b 100644
--- a/mullvad-cli/src/cmds/auto_connect.rs
+++ b/mullvad-cli/src/cmds/auto_connect.rs
@@ -21,7 +21,8 @@ impl Command for AutoConnect {
.required(true)
.possible_values(&["on", "off"]),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("get")
.about("Display the current auto-connect setting"),
)
diff --git a/mullvad-cli/src/cmds/lan.rs b/mullvad-cli/src/cmds/lan.rs
index 80a50a5047..2c833533cf 100644
--- a/mullvad-cli/src/cmds/lan.rs
+++ b/mullvad-cli/src/cmds/lan.rs
@@ -20,7 +20,8 @@ impl Command for Lan {
.required(true)
.possible_values(&["allow", "block"]),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("get")
.about("Display the current local network sharing setting"),
)
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs
index 70efb6362a..eda57070fb 100644
--- a/mullvad-cli/src/cmds/relay.rs
+++ b/mullvad-cli/src/cmds/relay.rs
@@ -26,7 +26,8 @@ impl Command for Relay {
clap::SubCommand::with_name("set")
.about(
"Set relay server selection parameters. Such as location and port/protocol",
- ).setting(clap::AppSettings::SubcommandRequired)
+ )
+ .setting(clap::AppSettings::SubcommandRequired)
.subcommand(
clap::SubCommand::with_name("custom")
.about("Set a custom VPN relay")
@@ -35,46 +36,55 @@ impl Command for Relay {
.required(true)
.index(1)
.possible_values(&["openvpn", "wireguard"]),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("host")
.help("Hostname or IP")
.required(true)
.index(2),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("port")
.help("Remote network port")
.required(true)
.index(3),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("protocol")
.help("Transport protocol. For Wireguard this is ignored.")
.index(4)
.default_value("udp")
.possible_values(&["udp", "tcp"]),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("location")
.about(
"Set country or city to select relays from. Use the 'list' \
command to show available alternatives.",
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("country")
.help(
"The two letter country code, or 'any' for no preference.",
- ).required(true)
+ )
+ .required(true)
.index(1)
.validator(country_code_validator),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("city")
.help("The three letter city code")
.index(2)
.validator(city_code_validator),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("hostname")
.help("The relay hostname")
.index(3),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("tunnel")
.about("Set tunnel constraints")
.arg(clap::Arg::with_name("port").required(true).index(1))
@@ -85,7 +95,8 @@ impl Command for Relay {
.possible_values(&["any", "udp", "tcp"]),
),
),
- ).subcommand(clap::SubCommand::with_name("get"))
+ )
+ .subcommand(clap::SubCommand::with_name("get"))
.subcommand(
clap::SubCommand::with_name("list").about("List available countries and cities"),
)
@@ -150,7 +161,8 @@ impl Relay {
("any", ..) => clap::Error::with_description(
"City can't be given when selecting 'any' country",
clap::ErrorKind::InvalidValue,
- ).exit(),
+ )
+ .exit(),
(country, None, None) => {
Constraint::Only(LocationConstraint::Country(country.to_owned()))
}
@@ -168,7 +180,8 @@ impl Relay {
(..) => clap::Error::with_description(
"Invalid country, city and hostname combination given",
clap::ErrorKind::InvalidValue,
- ).exit(),
+ )
+ .exit(),
};
self.update_constraints(RelaySettingsUpdate::Normal(RelayConstraintsUpdate {
diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs
index fee9188c5d..8d601cd345 100644
--- a/mullvad-cli/src/cmds/tunnel.rs
+++ b/mullvad-cli/src/cmds/tunnel.rs
@@ -26,14 +26,18 @@ impl Command for Tunnel {
.help(
"Sets the optional mssfix parameter. \
Set an empty string to clear it.",
- ).required(true),
+ )
+ .required(true),
),
- ).setting(clap::AppSettings::SubcommandRequired),
- ).subcommand(
+ )
+ .setting(clap::AppSettings::SubcommandRequired),
+ )
+ .subcommand(
clap::SubCommand::with_name("get")
.help("Retrieves the current setting for mssfix"),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("set")
.subcommand(
clap::SubCommand::with_name("ipv6").arg(
@@ -42,8 +46,10 @@ impl Command for Tunnel {
.takes_value(true)
.possible_values(&["on", "off"]),
),
- ).setting(clap::AppSettings::SubcommandRequired),
- ).subcommand(
+ )
+ .setting(clap::AppSettings::SubcommandRequired),
+ )
+ .subcommand(
clap::SubCommand::with_name("get")
.help("Retrieves the current setting for common tunnel options"),
)
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 9856ee5856..1c7f17c4e0 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -205,7 +205,8 @@ impl Daemon {
let https_handle = mullvad_rpc::rest::create_https_client(&ca_path, &handle);
let remote = core.remote();
(rpc, https_handle, remote)
- }).chain_err(|| "Unable to initialize network event loop")?;
+ })
+ .chain_err(|| "Unable to initialize network event loop")?;
let rpc_handle = rpc_handle.chain_err(|| "Unable to create RPC client")?;
let https_handle = https_handle.chain_err(|| "Unable to create am.i.mullvad client")?;
@@ -603,7 +604,8 @@ impl Daemon {
self.current_relay = Some(relay);
endpoint
}),
- }.map(|endpoint| self.build_tunnel_parameters(account_token, endpoint))
+ }
+ .map(|endpoint| self.build_tunnel_parameters(account_token, endpoint))
.map(|parameters| TunnelCommand::Connect(parameters))
.unwrap_or_else(|error| {
error!("{}", error.display_chain());
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index e8bd24ccc1..60f3b9a878 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -81,7 +81,8 @@ fn run() -> Result<()> {
config.log_level,
log_file.as_ref(),
config.log_stdout_timestamps,
- ).chain_err(|| ErrorKind::LogError("Unable to initialize logger"))?;
+ )
+ .chain_err(|| ErrorKind::LogError("Unable to initialize logger"))?;
log_panics::init();
log_version();
if let Some(ref log_dir) = log_dir {
@@ -146,7 +147,8 @@ fn create_daemon(config: cli::Config) -> Result<Daemon> {
resource_dir,
cache_dir,
version::CURRENT.to_owned(),
- ).chain_err(|| "Unable to initialize daemon")
+ )
+ .chain_err(|| "Unable to initialize daemon")
}
fn log_version() {
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index db5c3fedc1..318d0a6210 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -469,7 +469,8 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi
.send_command_to_daemon(ManagementCommand::SetTargetState(
tx,
TargetState::Unsecured,
- )).then(|_| future::ok(()));
+ ))
+ .then(|_| future::ok(()));
Box::new(future)
}
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs
index b55cfad22b..d325ca7163 100644
--- a/mullvad-daemon/src/relays.rs
+++ b/mullvad-daemon/src/relays.rs
@@ -330,7 +330,8 @@ impl RelaySelector {
.find(|relay| {
i = i.saturating_sub(relay.weight);
i == 0
- }).unwrap(),
+ })
+ .unwrap(),
)
}
}
diff --git a/mullvad-daemon/src/shutdown.rs b/mullvad-daemon/src/shutdown.rs
index ac41381e1e..41b454bab5 100644
--- a/mullvad-daemon/src/shutdown.rs
+++ b/mullvad-daemon/src/shutdown.rs
@@ -32,7 +32,8 @@ mod platform {
ctrlc::set_handler(move || {
debug!("Process received Ctrl-c");
f();
- }).chain_err(|| "Unable to attach ctrl-c handler")
+ })
+ .chain_err(|| "Unable to attach ctrl-c handler")
}
}
diff --git a/mullvad-ipc-client/src/lib.rs b/mullvad-ipc-client/src/lib.rs
index f7bc68da22..ca08f92333 100644
--- a/mullvad-ipc-client/src/lib.rs
+++ b/mullvad-ipc-client/src/lib.rs
@@ -245,7 +245,8 @@ impl DaemonRpcClient {
};
}
Ok(())
- }).wait();
+ })
+ .wait();
});
Ok(rx)
}
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index a76fb79544..cc5ff62ef3 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -107,14 +107,16 @@ fn run() -> Result<()> {
.value_name("PATH")
.takes_value(true)
.required(true),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("extra_logs")
.help("Paths to additional log files to be included.")
.multiple(true)
.value_name("EXTRA LOGS")
.takes_value(true)
.required(false),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("redact")
.help("List of words and expressions to remove from the report")
.long("redact")
@@ -122,7 +124,8 @@ fn run() -> Result<()> {
.multiple(true)
.takes_value(true),
),
- ).subcommand(
+ )
+ .subcommand(
clap::SubCommand::with_name("send")
.about("Send collected problem report")
.arg(
@@ -132,14 +135,16 @@ fn run() -> Result<()> {
.help("The path to previously collected report file.")
.takes_value(true)
.required(true),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("email")
.long("email")
.short("e")
.help("Reporter's email")
.takes_value(true)
.required(false),
- ).arg(
+ )
+ .arg(
clap::Arg::with_name("message")
.long("message")
.short("m")
@@ -183,11 +188,13 @@ fn collect_report(
let mut other_logs = Vec::new();
for log in logs {
match log {
- Ok(path) => if is_tunnel_log(&path) {
- problem_report.add_log(&path);
- } else {
- other_logs.push(path);
- },
+ Ok(path) => {
+ if is_tunnel_log(&path) {
+ problem_report.add_log(&path);
+ } else {
+ other_logs.push(path);
+ }
+ }
Err(error) => problem_report.add_error("Unable to get log path", error),
}
}
diff --git a/mullvad-rpc/src/rest.rs b/mullvad-rpc/src/rest.rs
index 00e2563915..988dfba7c0 100644
--- a/mullvad-rpc/src/rest.rs
+++ b/mullvad-rpc/src/rest.rs
@@ -55,7 +55,8 @@ fn create_request_processing_future<CC: hyper::client::Connect>(
} else {
future::err(ErrorKind::HttpError(response.status()).into())
}
- }).and_then(|response: hyper::Response| response.body().concat2().from_err())
+ })
+ .and_then(|response: hyper::Response| response.body().concat2().from_err())
.map(|response_chunk| response_chunk.to_vec())
.then(move |response_result| {
if let Err(_) = response_tx.send(response_result) {
diff --git a/mullvad-tests/src/lib.rs b/mullvad-tests/src/lib.rs
index 6683eb9be1..2a10ff5f3f 100644
--- a/mullvad-tests/src/lib.rs
+++ b/mullvad-tests/src/lib.rs
@@ -176,11 +176,13 @@ impl Iterator for PathWatcher {
path: Some(path),
op: Ok(op),
..
- }) => if path == self.path {
- return Some(op);
- } else {
- continue;
- },
+ }) => {
+ if path == self.path {
+ return Some(op);
+ } else {
+ continue;
+ }
+ }
Ok(_) => continue,
Err(_) => return None,
}
@@ -263,7 +265,8 @@ fn prepare_relay_list<T: AsRef<Path>>(path: T) {
}]
}]
}"#,
- ).expect("Failed to create mock relay list file");
+ )
+ .expect("Failed to create mock relay list file");
}
pub struct DaemonRunner {
@@ -315,7 +318,8 @@ impl DaemonRunner {
mullvad_ipc_client::new_standalone_transport(socket_path, |path| {
IpcTransport::new(&path, &Handle::current())
.chain_err(|| mullvad_ipc_client::ErrorKind::TransportError)
- }).map_err(|e| format!("Failed to construct an RPC client - {}", e))
+ })
+ .map_err(|e| format!("Failed to construct an RPC client - {}", e))
}
#[cfg(unix)]
@@ -372,7 +376,8 @@ impl MockOpenVpnPluginRpcClient {
let result = IpcTransport::new(&address, &Handle::current())
.map_err(|error| {
format!("Failed to create Mock OpenVPN plugin RPC client: {}", error)
- }).map(Transport::into_client);
+ })
+ .map(Transport::into_client);
match result {
Ok((client, client_handle)) => {
tx.send(Ok(client_handle)).unwrap();
diff --git a/mullvad-types/src/custom_tunnel.rs b/mullvad-types/src/custom_tunnel.rs
index 7b2f17ae67..5542ef9e71 100644
--- a/mullvad-types/src/custom_tunnel.rs
+++ b/mullvad-types/src/custom_tunnel.rs
@@ -41,5 +41,6 @@ fn resolve_to_ip(host: &str) -> Result<IpAddr> {
.or_else(|| {
info!("No IPv4 for host {}", host);
ipv6.pop()
- }).ok_or_else(|| ErrorKind::InvalidHost(host.to_owned()).into())
+ })
+ .ok_or_else(|| ErrorKind::InvalidHost(host.to_owned()).into())
}
diff --git a/talpid-core/src/security/macos/dns.rs b/talpid-core/src/security/macos/dns.rs
index 5cadf3f58d..6ecc9cfbd0 100644
--- a/talpid-core/src/security/macos/dns.rs
+++ b/talpid-core/src/security/macos/dns.rs
@@ -89,19 +89,21 @@ impl DnsMonitor {
backup,
}
}
- Some(state) => if servers != state.desired_dns {
- debug!("Changing DNS to [{}]", servers.join(", "));
- for service_path in state.backup.keys() {
- set_dns(&self.store, CFString::new(service_path), &servers)?;
- }
- State {
- desired_dns: servers,
- backup: state.backup,
+ Some(state) => {
+ if servers != state.desired_dns {
+ debug!("Changing DNS to [{}]", servers.join(", "));
+ for service_path in state.backup.keys() {
+ set_dns(&self.store, CFString::new(service_path), &servers)?;
+ }
+ State {
+ desired_dns: servers,
+ backup: state.backup,
+ }
+ } else {
+ debug!("No change, new DNS same as the one already set");
+ state
}
- } else {
- debug!("No change, new DNS same as the one already set");
- state
- },
+ }
});
Ok(())
}
@@ -180,41 +182,45 @@ fn dns_change_callback_internal(
None => {
trace!("Not injecting DNS at this time");
}
- Some(ref mut state) => for path in changed_keys.iter() {
- let should_set_dns = match read_dns(&store, path.clone()) {
- None => {
- debug!("Detected DNS removed for {}", *path);
- state.backup.insert(path.to_string(), None);
- true
- }
- Some(servers) => if servers != state.desired_dns {
- debug!(
- "Detected DNS changed to [{}] for {}",
- servers.join(", "),
- *path
- );
- state.backup.insert(path.to_string(), Some(servers));
- true
- } else {
- false
- },
- };
- if should_set_dns {
- set_dns(&store, path.clone(), &state.desired_dns)
- .chain_err(|| format!("Failed changing DNS for {}", *path))?;
- // If we changed a state DNS, also set the corresponding setup DNS.
- if let Some(setup_path_str) = state_to_setup_path(&path.to_string()) {
- let setup_path = CFString::new(&setup_path_str);
- if !state.backup.contains_key(&setup_path_str) {
- state
- .backup
- .insert(setup_path_str, read_dns(&store, setup_path.clone()));
+ Some(ref mut state) => {
+ for path in changed_keys.iter() {
+ let should_set_dns = match read_dns(&store, path.clone()) {
+ None => {
+ debug!("Detected DNS removed for {}", *path);
+ state.backup.insert(path.to_string(), None);
+ true
+ }
+ Some(servers) => {
+ if servers != state.desired_dns {
+ debug!(
+ "Detected DNS changed to [{}] for {}",
+ servers.join(", "),
+ *path
+ );
+ state.backup.insert(path.to_string(), Some(servers));
+ true
+ } else {
+ false
+ }
+ }
+ };
+ if should_set_dns {
+ set_dns(&store, path.clone(), &state.desired_dns)
+ .chain_err(|| format!("Failed changing DNS for {}", *path))?;
+ // If we changed a state DNS, also set the corresponding setup DNS.
+ if let Some(setup_path_str) = state_to_setup_path(&path.to_string()) {
+ let setup_path = CFString::new(&setup_path_str);
+ if !state.backup.contains_key(&setup_path_str) {
+ state
+ .backup
+ .insert(setup_path_str, read_dns(&store, setup_path.clone()));
+ }
+ set_dns(&store, setup_path.clone(), &state.desired_dns)
+ .chain_err(|| format!("Failed changing DNS for {}", setup_path))?;
}
- set_dns(&store, setup_path.clone(), &state.desired_dns)
- .chain_err(|| format!("Failed changing DNS for {}", setup_path))?;
}
}
- },
+ }
}
Ok(())
}
@@ -281,7 +287,8 @@ fn read_dns(store: &SCDynamicStore, path: CFString) -> Option<Vec<DnsServer>> {
dictionary
.find2(&CFString::from_static_string("ServerAddresses"))
.map(|array_ptr| unsafe { CFType::wrap_under_get_rule(array_ptr) })
- }).and_then(|addresses| {
+ })
+ .and_then(|addresses| {
if let Some(array) = addresses.downcast::<CFArray<CFType>>() {
parse_cf_array_to_strings(array)
} else {
diff --git a/talpid-core/src/security/macos/mod.rs b/talpid-core/src/security/macos/mod.rs
index 2d53ace804..f83567f91e 100644
--- a/talpid-core/src/security/macos/mod.rs
+++ b/talpid-core/src/security/macos/mod.rs
@@ -55,7 +55,8 @@ impl NetworkSecurityT for NetworkSecurity {
self.remove_anchor(),
self.restore_state(),
self.restore_dns(),
- ].into_iter()
+ ]
+ .into_iter()
.collect::<Result<Vec<_>>>()
.map(|_| ())
}
@@ -206,7 +207,8 @@ impl NetworkSecurity {
let allow_multicast = rule_builder
.to(pfctl::Ip::from(ipnetwork_compat(IpNetwork::V4(
*super::MULTICAST_NET,
- )))).build()?;
+ ))))
+ .build()?;
let allow_ssdp = rule_builder.to(pfctl::Ip::from(*super::SSDP_IP)).build()?;
rules.push(allow_net);
rules.push(allow_multicast);
@@ -225,7 +227,8 @@ impl NetworkSecurity {
let allow_multicast = rule_builder
.to(pfctl::Ip::from(ipnetwork_compat(IpNetwork::V6(
*super::MULTICAST_INET6_NET,
- )))).build()?;
+ ))))
+ .build()?;
rules.push(allow_net);
rules.push(allow_multicast);
}
diff --git a/talpid-core/src/security/windows/dns.rs b/talpid-core/src/security/windows/dns.rs
index f89d2e21b8..70ca60842d 100644
--- a/talpid-core/src/security/windows/dns.rs
+++ b/talpid-core/src/security/windows/dns.rs
@@ -91,7 +91,8 @@ impl WinDns {
widestring_ips.len() as u32,
Some(write_system_state_backup_cb),
&self.backup_writer as *const _ as *const c_void,
- ).into_result()
+ )
+ .into_result()
}
}
diff --git a/talpid-core/src/security/windows/mod.rs b/talpid-core/src/security/windows/mod.rs
index 6ecca8988b..2dba99d724 100644
--- a/talpid-core/src/security/windows/mod.rs
+++ b/talpid-core/src/security/windows/mod.rs
@@ -76,7 +76,8 @@ impl NetworkSecurityT for NetworkSecurity {
WINFW_TIMEOUT_SECONDS,
Some(winnet::error_sink),
ptr::null_mut(),
- ).into_result()?
+ )
+ .into_result()?
};
trace!("Successfully initialized windows firewall module");
Ok(NetworkSecurity { dns: windns })
@@ -184,7 +185,8 @@ impl NetworkSecurity {
&winfw_relay,
tunnel_alias.as_wide_c_str().as_ptr(),
gateway_str.as_wide_c_str().as_ptr(),
- ).into_result()
+ )
+ .into_result()
}
}
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 2c84f16596..4a37296575 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -190,7 +190,8 @@ impl TunnelMonitor {
cmd,
on_openvpn_event,
Self::get_plugin_path(resource_dir)?,
- ).chain_err(|| ErrorKind::TunnelMonitoringError)?;
+ )
+ .chain_err(|| ErrorKind::TunnelMonitoringError)?;
Ok(TunnelMonitor {
monitor,
_user_pass_file: user_pass_file,
@@ -337,7 +338,8 @@ fn is_ipv6_enabled_in_os() -> bool {
.and_then(|ipv6_config| ipv6_config.get_value("DisabledComponents"))
.map(|ipv6_disabled_bits: u32| {
(ipv6_disabled_bits & IPV6_DISABLED_ON_TUNNELS_MASK) == 0
- }).unwrap_or(true);
+ })
+ .unwrap_or(true);
let enabled_on_tap = ::winnet::get_tap_interface_ipv6_status().unwrap_or(false);
if !globally_enabled {
diff --git a/talpid-core/src/tunnel/openvpn.rs b/talpid-core/src/tunnel/openvpn.rs
index 8e89ed4a5c..0eeae37faf 100644
--- a/talpid-core/src/tunnel/openvpn.rs
+++ b/talpid-core/src/tunnel/openvpn.rs
@@ -89,16 +89,18 @@ impl<C: OpenVpnBuilder> OpenVpnMonitor<C> {
/// for the process or in the event dispatcher.
pub fn wait(mut self) -> Result<()> {
match self.wait_result() {
- WaitResult::Child(Ok(exit_status), closed) => if exit_status.success() || closed {
- debug!(
- "OpenVPN exited, as expected, with exit status: {}",
- exit_status
- );
- Ok(())
- } else {
- error!("OpenVPN died unexpectedly with status: {}", exit_status);
- Err(ErrorKind::ChildProcessError("Died unexpectedly").into())
- },
+ WaitResult::Child(Ok(exit_status), closed) => {
+ if exit_status.success() || closed {
+ debug!(
+ "OpenVPN exited, as expected, with exit status: {}",
+ exit_status
+ );
+ Ok(())
+ } else {
+ error!("OpenVPN died unexpectedly with status: {}", exit_status);
+ Err(ErrorKind::ChildProcessError("Died unexpectedly").into())
+ }
+ }
WaitResult::Child(Err(e), _) => {
error!("OpenVPN process wait error: {}", e);
Err(e).chain_err(|| ErrorKind::ChildProcessError("Error when waiting"))
diff --git a/talpid-ipc/src/lib.rs b/talpid-ipc/src/lib.rs
index 16d952a5be..aeecb35b7f 100644
--- a/talpid-ipc/src/lib.rs
+++ b/talpid-ipc/src/lib.rs
@@ -81,7 +81,8 @@ impl IpcServer {
.map(|e| Err(e))
.unwrap_or(Ok(server))
.chain_err(|| ErrorKind::IpcServerError)
- }).map(|server| IpcServer {
+ })
+ .map(|server| IpcServer {
path: path.to_owned(),
server,
})?;