summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-01-04 05:46:23 +0100
committerDavid Lönnhager <david.l@mullvad.net>2024-01-05 17:02:12 +0100
commit5131624541f6a9f456de347b62f69f4c5591c5c4 (patch)
tree0d24ceecbf9299cb8c445d01a1c25f994d0067aa
parent62df52bb1e7b81d44e0f7bd73ec2aa5882311db9 (diff)
downloadmullvadvpn-5131624541f6a9f456de347b62f69f4c5591c5c4.tar.xz
mullvadvpn-5131624541f6a9f456de347b62f69f4c5591c5c4.zip
Run `cargo +nightly fmt`
-rw-r--r--ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/ffi.rs6
-rw-r--r--ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/lib.rs3
-rw-r--r--mullvad-api/src/lib.rs2
-rw-r--r--mullvad-api/src/proxy.rs3
-rw-r--r--mullvad-cli/src/cmds/api_access.rs6
-rw-r--r--mullvad-cli/src/cmds/import_settings.rs4
-rw-r--r--mullvad-daemon/src/api.rs4
-rw-r--r--mullvad-daemon/src/device/mod.rs3
-rw-r--r--mullvad-daemon/src/exception_logging/unix.rs7
-rw-r--r--mullvad-daemon/src/migrations/mod.rs4
-rw-r--r--mullvad-daemon/src/tunnel.rs3
-rw-r--r--mullvad-nsis/src/lib.rs4
-rw-r--r--mullvad-paths/src/windows.rs14
-rw-r--r--mullvad-types/src/account.rs3
-rw-r--r--talpid-core/src/dns/windows/iphlpapi.rs6
-rw-r--r--talpid-core/src/firewall/macos.rs4
-rw-r--r--talpid-core/src/firewall/windows.rs7
-rw-r--r--talpid-openvpn/src/lib.rs3
-rw-r--r--talpid-openvpn/src/process/openvpn.rs4
-rw-r--r--talpid-routing/src/unix/macos/mod.rs2
-rw-r--r--talpid-windows/src/net.rs2
21 files changed, 52 insertions, 42 deletions
diff --git a/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/ffi.rs b/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/ffi.rs
index 1f7e5741d8..c652b43e24 100644
--- a/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/ffi.rs
+++ b/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/ffi.rs
@@ -1,8 +1,10 @@
#![cfg(target_os = "ios")]
use super::{TunnelObfuscatorHandle, TunnelObfuscatorRuntime};
-use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
-use std::sync::Once;
+use std::{
+ net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
+ sync::Once,
+};
static INIT_LOGGING: Once = Once::new();
diff --git a/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/lib.rs b/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/lib.rs
index 09ac816bfa..198c7f4922 100644
--- a/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/lib.rs
+++ b/ios/TunnelObfuscation/tunnel-obfuscator-proxy/src/lib.rs
@@ -1,7 +1,6 @@
#![cfg(target_os = "ios")]
-use std::io;
-use std::net::SocketAddr;
+use std::{io, net::SocketAddr};
use tokio::sync::oneshot;
use tunnel_obfuscation::{create_obfuscator, Settings as ObfuscationSettings, Udp2TcpSettings};
diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs
index e66896a1b0..ae7929deec 100644
--- a/mullvad-api/src/lib.rs
+++ b/mullvad-api/src/lib.rs
@@ -9,7 +9,6 @@ use mullvad_types::{
version::AppVersion,
};
use proxy::ApiConnectionMode;
-use std::sync::OnceLock;
use std::{
cell::Cell,
collections::BTreeMap,
@@ -17,6 +16,7 @@ use std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
ops::Deref,
path::Path,
+ sync::OnceLock,
};
use talpid_types::{net::AllowedEndpoint, ErrorExt};
diff --git a/mullvad-api/src/proxy.rs b/mullvad-api/src/proxy.rs
index caf2068abb..3c7d071d92 100644
--- a/mullvad-api/src/proxy.rs
+++ b/mullvad-api/src/proxy.rs
@@ -7,9 +7,8 @@ use std::{
pin::Pin,
task::{self, Poll},
};
-use talpid_types::net::proxy;
use talpid_types::{
- net::{AllowedClients, Endpoint, TransportProtocol},
+ net::{proxy, AllowedClients, Endpoint, TransportProtocol},
ErrorExt,
};
use tokio::{
diff --git a/mullvad-cli/src/cmds/api_access.rs b/mullvad-cli/src/cmds/api_access.rs
index 887d378fa4..8883ea516b 100644
--- a/mullvad-cli/src/cmds/api_access.rs
+++ b/mullvad-cli/src/cmds/api_access.rs
@@ -26,9 +26,11 @@ pub enum ApiAccess {
Enable(SelectItem),
/// Disable an API access method
Disable(SelectItem),
- /// Try to use a specific API access method (If the API is unreachable, reverts back to the previous access method)
+ /// Try to use a specific API access method (If the API is unreachable, reverts back to the
+ /// previous access method)
///
- /// Selecting "Direct" will connect to the Mullvad API without going through any proxy. This connection use https and is therefore encrypted.
+ /// Selecting "Direct" will connect to the Mullvad API without going through any proxy. This
+ /// connection use https and is therefore encrypted.
///
/// Selecting "Mullvad Bridges" respects your current bridge settings
Use(SelectItem),
diff --git a/mullvad-cli/src/cmds/import_settings.rs b/mullvad-cli/src/cmds/import_settings.rs
index a354eb4b95..a89c6814c3 100644
--- a/mullvad-cli/src/cmds/import_settings.rs
+++ b/mullvad-cli/src/cmds/import_settings.rs
@@ -9,8 +9,8 @@ use std::{
/// Maximum size of a settings patch. Bigger files/streams cause the read to fail.
const MAX_PATCH_BYTES: usize = 10 * 1024;
-/// If source is specified, read from the provided file and send it as a settings patch to the daemon.
-/// Otherwise, read the patch from standard input.
+/// If source is specified, read from the provided file and send it as a settings patch to the
+/// daemon. Otherwise, read the patch from standard input.
pub async fn handle(source: String) -> Result<()> {
let json_blob = tokio::task::spawn_blocking(|| get_blob(source))
.await
diff --git a/mullvad-daemon/src/api.rs b/mullvad-daemon/src/api.rs
index c13bf77ded..efb8f3088d 100644
--- a/mullvad-daemon/src/api.rs
+++ b/mullvad-daemon/src/api.rs
@@ -49,9 +49,9 @@ impl std::fmt::Display for Message {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Message::Get(_) => f.write_str("Get"),
- Message::Set(_, _) => f.write_str("Set"),
+ Message::Set(..) => f.write_str("Set"),
Message::Next(_) => f.write_str("Next"),
- Message::Update(_, _) => f.write_str("Update"),
+ Message::Update(..) => f.write_str("Update"),
}
}
}
diff --git a/mullvad-daemon/src/device/mod.rs b/mullvad-daemon/src/device/mod.rs
index 70d491b4c6..ac65e2fbd5 100644
--- a/mullvad-daemon/src/device/mod.rs
+++ b/mullvad-daemon/src/device/mod.rs
@@ -1347,8 +1347,7 @@ impl TunnelStateChangeHandler {
#[cfg(test)]
mod test {
- use super::TunnelStateChangeHandler;
- use super::{Error, WG_DEVICE_CHECK_THRESHOLD};
+ use super::{Error, TunnelStateChangeHandler, WG_DEVICE_CHECK_THRESHOLD};
use mullvad_relay_selector::RelaySelector;
use std::sync::{
atomic::{AtomicBool, Ordering},
diff --git a/mullvad-daemon/src/exception_logging/unix.rs b/mullvad-daemon/src/exception_logging/unix.rs
index 4cb3a35ac5..45948224b9 100644
--- a/mullvad-daemon/src/exception_logging/unix.rs
+++ b/mullvad-daemon/src/exception_logging/unix.rs
@@ -3,8 +3,11 @@
use libc::siginfo_t;
use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
-use std::ffi::{c_int, c_void};
-use std::{convert::TryFrom, sync::Once};
+use std::{
+ convert::TryFrom,
+ ffi::{c_int, c_void},
+ sync::Once,
+};
static INIT_ONCE: Once = Once::new();
diff --git a/mullvad-daemon/src/migrations/mod.rs b/mullvad-daemon/src/migrations/mod.rs
index 5d13372a07..363c0bd282 100644
--- a/mullvad-daemon/src/migrations/mod.rs
+++ b/mullvad-daemon/src/migrations/mod.rs
@@ -25,8 +25,8 @@
//! # Creating a migration
//!
//! 1. Copy `vX.rs.template` to `vX.rs` where `X` is the latest settings version right now.
-//! 1. Add the new version (`Y = X+1`) to `SettingsVersion` and bump `CURRENT_SETTINGS_VERSION`
-//! to `Y`.
+//! 1. Add the new version (`Y = X+1`) to `SettingsVersion` and bump `CURRENT_SETTINGS_VERSION` to
+//! `Y`.
//! 1. Write a comment in the new module about how the format changed, what it needs to migrate.
//! 1. Implement the migration and add adequate tests.
//! 1. Add to the changelog: "Settings format updated to `vY`"
diff --git a/mullvad-daemon/src/tunnel.rs b/mullvad-daemon/src/tunnel.rs
index 7af7adc4d0..a19c81740c 100644
--- a/mullvad-daemon/src/tunnel.rs
+++ b/mullvad-daemon/src/tunnel.rs
@@ -217,7 +217,8 @@ impl InnerParametersGenerator {
private_key: data.device.wg_data.private_key,
addresses: vec![IpAddr::from(tunnel_ipv4), IpAddr::from(tunnel_ipv6)],
};
- // FIXME: Used for debugging purposes during the migration to same IP. Remove when the migration is over.
+ // FIXME: Used for debugging purposes during the migration to same IP. Remove when
+ // the migration is over.
if tunnel_ipv4 == *SAME_IP_V4 || tunnel_ipv6 == *SAME_IP_V6 {
log::debug!("Same IP is being used");
} else {
diff --git a/mullvad-nsis/src/lib.rs b/mullvad-nsis/src/lib.rs
index 24e1e86f77..7dd707b5e0 100644
--- a/mullvad-nsis/src/lib.rs
+++ b/mullvad-nsis/src/lib.rs
@@ -20,8 +20,8 @@ pub enum Status {
/// Max path size allowed
const MAX_PATH_SIZE: isize = 32_767;
-/// SAFETY: path needs to be a windows path encoded as a string of u16 that terminates in 0 (two nul-bytes).
-/// The string is also not allowed to be greater than `MAX_PATH_SIZE`.
+/// SAFETY: path needs to be a windows path encoded as a string of u16 that terminates in 0 (two
+/// nul-bytes). The string is also not allowed to be greater than `MAX_PATH_SIZE`.
#[no_mangle]
pub unsafe extern "C" fn create_privileged_directory(path: *const u16) -> Status {
catch_and_log_unwind(|| {
diff --git a/mullvad-paths/src/windows.rs b/mullvad-paths/src/windows.rs
index e41f9faec9..912831a53c 100644
--- a/mullvad-paths/src/windows.rs
+++ b/mullvad-paths/src/windows.rs
@@ -67,7 +67,8 @@ fn get_wide_str<S: AsRef<OsStr>>(string: S) -> Vec<u16> {
/// Recursively creates directories, if set_security_permissions is true it will set
/// file permissions corresponding to Authenticated Users - Read Only and Administrators - Full
-/// Access. Only directories that do not already exist and the leaf directory will have their permissions set.
+/// Access. Only directories that do not already exist and the leaf directory will have their
+/// permissions set.
pub fn create_dir_recursive(path: &Path, set_security_permissions: bool) -> Result<()> {
if set_security_permissions {
create_dir_with_permissions_recursive(path)
@@ -114,7 +115,8 @@ fn create_dir_with_permissions_recursive(path: &Path) -> Result<()> {
// Create parent directory
Some(parent) => create_dir_with_permissions_recursive(parent)?,
None => {
- // Reached the top of the tree but when creating directories only got NotFound for some reason
+ // Reached the top of the tree but when creating directories only got NotFound for some
+ // reason
return Err(Error::CreateDirFailed(
path.display().to_string(),
io::Error::new(
@@ -129,13 +131,15 @@ fn create_dir_with_permissions_recursive(path: &Path) -> Result<()> {
set_security_permissions(path)
}
-/// Recursively creates directories for the given path with permissions that give full access to admins and read only access to authenticated users.
-/// If any of the directories already exist this will not return an error, instead it will apply the permissions and if successful return Ok(()).
+/// Recursively creates directories for the given path with permissions that give full access to
+/// admins and read only access to authenticated users. If any of the directories already exist this
+/// will not return an error, instead it will apply the permissions and if successful return Ok(()).
pub fn create_privileged_directory(path: &Path) -> Result<()> {
create_dir_with_permissions_recursive(path)
}
-/// Sets security permissions for path such that admin has full ownership and access while authenticated users only have read access.
+/// Sets security permissions for path such that admin has full ownership and access while
+/// authenticated users only have read access.
fn set_security_permissions(path: &Path) -> Result<()> {
let wide_path = get_wide_str(path);
let security_information = Security::DACL_SECURITY_INFORMATION
diff --git a/mullvad-types/src/account.rs b/mullvad-types/src/account.rs
index bb59f14fb1..d3c54d5bcd 100644
--- a/mullvad-types/src/account.rs
+++ b/mullvad-types/src/account.rs
@@ -49,7 +49,8 @@ pub struct VoucherSubmission {
pub new_expiry: DateTime<Utc>,
}
-/// `PlayPurchase` is provided to google in order to verify that a google play purchase was acknowledged.
+/// `PlayPurchase` is provided to google in order to verify that a google play purchase was
+/// acknowledged.
#[derive(Deserialize, Serialize, Debug, Clone)]
#[cfg_attr(target_os = "android", derive(FromJava))]
#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))]
diff --git a/talpid-core/src/dns/windows/iphlpapi.rs b/talpid-core/src/dns/windows/iphlpapi.rs
index f9aba70065..e48b3b65f5 100644
--- a/talpid-core/src/dns/windows/iphlpapi.rs
+++ b/talpid-core/src/dns/windows/iphlpapi.rs
@@ -80,9 +80,9 @@ impl IphlpApi {
return Err(Error::LoadDll(io::Error::last_os_error()));
}
- // This function is loaded at runtime since it may be unavailable. See the module-level docs.
- // TODO: `windows_sys` can be used directly when support for versions older than Windows 10,
- // 2004, is dropped.
+ // This function is loaded at runtime since it may be unavailable. See the module-level
+ // docs. TODO: `windows_sys` can be used directly when support for versions older
+ // than Windows 10, 2004, is dropped.
let set_interface_dns_settings =
unsafe { GetProcAddress(module, s!("SetInterfaceDnsSettings")) };
let set_interface_dns_settings = set_interface_dns_settings.ok_or_else(|| {
diff --git a/talpid-core/src/firewall/macos.rs b/talpid-core/src/firewall/macos.rs
index c851be507f..07e74f45ff 100644
--- a/talpid-core/src/firewall/macos.rs
+++ b/talpid-core/src/firewall/macos.rs
@@ -294,8 +294,8 @@ impl Firewall {
builder.build()
}
- /// Produces a rule that allows traffic to flow to the API. Allows the app (or other apps if configured)
- /// to reach the API in blocked states.
+ /// Produces a rule that allows traffic to flow to the API. Allows the app (or other apps if
+ /// configured) to reach the API in blocked states.
fn get_allowed_endpoint_rule(
&self,
allowed_endpoint: &AllowedEndpoint,
diff --git a/talpid-core/src/firewall/windows.rs b/talpid-core/src/firewall/windows.rs
index f26102820a..c751a283a5 100644
--- a/talpid-core/src/firewall/windows.rs
+++ b/talpid-core/src/firewall/windows.rs
@@ -153,8 +153,8 @@ impl Firewall {
protocol: WinFwProt::from(endpoint.endpoint.protocol),
};
- // SAFETY: `endpoint1_ip`, `endpoint2_ip`, `endpoint1`, `endpoint2`, `relay_client_wstrs` must not be dropped
- // until `WinFw_ApplyPolicyConnecting` has returned.
+ // SAFETY: `endpoint1_ip`, `endpoint2_ip`, `endpoint1`, `endpoint2`, `relay_client_wstrs`
+ // must not be dropped until `WinFw_ApplyPolicyConnecting` has returned.
let relay_client_wstrs: Vec<_> = endpoint
.clients
@@ -274,7 +274,8 @@ impl Firewall {
None => ptr::null(),
};
- // SAFETY: `relay_client_wstrs` must not be dropped until `WinFw_ApplyPolicyConnected` has returned.
+ // SAFETY: `relay_client_wstrs` must not be dropped until `WinFw_ApplyPolicyConnected` has
+ // returned.
let relay_client_wstrs: Vec<_> = endpoint
.clients
.iter()
diff --git a/talpid-openvpn/src/lib.rs b/talpid-openvpn/src/lib.rs
index 47d1bc675a..04f94a1a84 100644
--- a/talpid-openvpn/src/lib.rs
+++ b/talpid-openvpn/src/lib.rs
@@ -755,8 +755,7 @@ mod event_server {
task::{Context, Poll},
};
use talpid_tunnel::TunnelMetadata;
- use talpid_types::net::proxy::CustomProxy;
- use talpid_types::ErrorExt;
+ use talpid_types::{net::proxy::CustomProxy, ErrorExt};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tonic::{
self,
diff --git a/talpid-openvpn/src/process/openvpn.rs b/talpid-openvpn/src/process/openvpn.rs
index 84b9c88534..c45c2c0a90 100644
--- a/talpid-openvpn/src/process/openvpn.rs
+++ b/talpid-openvpn/src/process/openvpn.rs
@@ -440,8 +440,8 @@ impl OpenVpnProcHandle {
})
}
- /// Begins to kill the process, causing `wait()` to return. This function does not wait for the operation
- /// to complete.
+ /// Begins to kill the process, causing `wait()` to return. This function does not wait for the
+ /// operation to complete.
pub fn kill(&mut self, timeout: std::time::Duration) {
if let Some(tx) = self.stop_tx.take() {
let _ = tx.send(timeout);
diff --git a/talpid-routing/src/unix/macos/mod.rs b/talpid-routing/src/unix/macos/mod.rs
index 5b69402939..ec5da51bae 100644
--- a/talpid-routing/src/unix/macos/mod.rs
+++ b/talpid-routing/src/unix/macos/mod.rs
@@ -6,10 +6,10 @@ use futures::{
stream::{FusedStream, StreamExt},
};
use ipnetwork::IpNetwork;
-use std::sync::Weak;
use std::{
collections::{BTreeMap, HashSet},
pin::Pin,
+ sync::Weak,
time::Duration,
};
use talpid_types::ErrorExt;
diff --git a/talpid-windows/src/net.rs b/talpid-windows/src/net.rs
index 7147bb35b0..e9899743d6 100644
--- a/talpid-windows/src/net.rs
+++ b/talpid-windows/src/net.rs
@@ -11,7 +11,6 @@ use std::{
use talpid_types::win32_err;
use windows_sys::{
core::GUID,
- Win32::Networking::WinSock::SOCKADDR_STORAGE as sockaddr_storage,
Win32::{
Foundation::{ERROR_NOT_FOUND, HANDLE},
NetworkManagement::{
@@ -30,6 +29,7 @@ use windows_sys::{
IpDadStateDeprecated, IpDadStateDuplicate, IpDadStateInvalid, IpDadStatePreferred,
IpDadStateTentative, AF_INET, AF_INET6, AF_UNSPEC, IN6_ADDR, IN_ADDR, NL_DAD_STATE,
SOCKADDR_IN as sockaddr_in, SOCKADDR_IN6 as sockaddr_in6, SOCKADDR_INET,
+ SOCKADDR_STORAGE as sockaddr_storage,
},
},
};