summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2025-02-11 14:34:17 +0100
committerSebastian Holmin <sebastian.holmin@mullvad.net>2025-02-12 10:15:31 +0100
commit74d800fa2274517622b891745b629f62d6239a8a (patch)
tree338c9a93d99afaeca72a4861a5f1ea31a27b7a3f /talpid-core/src
parentf55ec2043a07f625c87fad4368bb252e09162863 (diff)
downloadmullvadvpn-74d800fa2274517622b891745b629f62d6239a8a.tar.xz
mullvadvpn-74d800fa2274517622b891745b629f62d6239a8a.zip
Format workspace
The 2024 edition contains new formatting rules. All of these are not compatible with the 2021 formatting style, but most of them are. To change the formatting to be as close to the new style as possible while remaining compatible with the 2021 edition, I first ran `cargo +beta fmt` with the edition set to 2024, then, with the edition set to 2021, I ran `cargo fmt`.
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/dns/windows/dnsapi.rs3
-rw-r--r--talpid-core/src/firewall/windows/mod.rs6
-rw-r--r--talpid-core/src/split_tunnel/windows/driver.rs12
-rw-r--r--talpid-core/src/split_tunnel/windows/volume_monitor.rs10
-rw-r--r--talpid-core/src/window.rs10
5 files changed, 20 insertions, 21 deletions
diff --git a/talpid-core/src/dns/windows/dnsapi.rs b/talpid-core/src/dns/windows/dnsapi.rs
index dcf04d22b2..03d9d44abf 100644
--- a/talpid-core/src/dns/windows/dnsapi.rs
+++ b/talpid-core/src/dns/windows/dnsapi.rs
@@ -1,8 +1,7 @@
use std::{
sync::{
- Arc, OnceLock,
atomic::{AtomicUsize, Ordering},
- mpsc,
+ mpsc, Arc, OnceLock,
},
time::{Duration, Instant},
};
diff --git a/talpid-core/src/firewall/windows/mod.rs b/talpid-core/src/firewall/windows/mod.rs
index 51f5adc498..8dadd7db5c 100644
--- a/talpid-core/src/firewall/windows/mod.rs
+++ b/talpid-core/src/firewall/windows/mod.rs
@@ -5,12 +5,12 @@ use std::{ffi::CStr, io, net::IpAddr, ptr, sync::LazyLock};
use self::winfw::*;
use super::{FirewallArguments, FirewallPolicy, InitialFirewallState};
use talpid_types::{
- ErrorExt,
net::{AllowedEndpoint, AllowedTunnelTraffic},
tunnel::FirewallPolicyError,
+ ErrorExt,
};
use widestring::WideCString;
-use windows_sys::Win32::Globalization::{CP_ACP, MultiByteToWideChar};
+use windows_sys::Win32::Globalization::{MultiByteToWideChar, CP_ACP};
mod hyperv;
@@ -554,7 +554,7 @@ fn with_wmi_if_enabled(f: impl FnOnce(&wmi::WMIConnection)) {
#[allow(non_snake_case)]
mod winfw {
- use super::{AllowedEndpoint, AllowedTunnelTraffic, Error, WideCString, widestring_ip};
+ use super::{widestring_ip, AllowedEndpoint, AllowedTunnelTraffic, Error, WideCString};
use std::ffi::{c_char, c_void};
use talpid_types::net::TransportProtocol;
diff --git a/talpid-core/src/split_tunnel/windows/driver.rs b/talpid-core/src/split_tunnel/windows/driver.rs
index 481514c61b..e3026b0d95 100644
--- a/talpid-core/src/split_tunnel/windows/driver.rs
+++ b/talpid-core/src/split_tunnel/windows/driver.rs
@@ -1,6 +1,6 @@
use super::windows::{
- ProcessAccess, get_device_path, get_process_creation_time, get_process_device_path,
- open_process,
+ get_device_path, get_process_creation_time, get_process_device_path, open_process,
+ ProcessAccess,
};
use bitflags::bitflags;
use memoffset::offset_of;
@@ -10,7 +10,7 @@ use std::{
ffi::{OsStr, OsString},
fs::{self, OpenOptions},
io,
- mem::{self, MaybeUninit, size_of},
+ mem::{self, size_of, MaybeUninit},
net::{Ipv4Addr, Ipv6Addr},
os::windows::{
ffi::{OsStrExt, OsStringExt},
@@ -28,13 +28,13 @@ use windows_sys::Win32::{
ERROR_ACCESS_DENIED, ERROR_FILE_NOT_FOUND, ERROR_INVALID_PARAMETER, ERROR_IO_PENDING,
HANDLE, NTSTATUS, WAIT_ABANDONED, WAIT_ABANDONED_0, WAIT_FAILED, WAIT_OBJECT_0,
},
- Networking::WinSock::{IN_ADDR, IN6_ADDR},
+ Networking::WinSock::{IN6_ADDR, IN_ADDR},
Storage::FileSystem::FILE_FLAG_OVERLAPPED,
System::{
Diagnostics::ToolHelp::TH32CS_SNAPPROCESS,
- IO::{DeviceIoControl, GetOverlappedResult, OVERLAPPED},
Ioctl::{FILE_ANY_ACCESS, METHOD_BUFFERED, METHOD_NEITHER},
- Threading::{INFINITE, WaitForMultipleObjects, WaitForSingleObject},
+ Threading::{WaitForMultipleObjects, WaitForSingleObject, INFINITE},
+ IO::{DeviceIoControl, GetOverlappedResult, OVERLAPPED},
},
};
diff --git a/talpid-core/src/split_tunnel/windows/volume_monitor.rs b/talpid-core/src/split_tunnel/windows/volume_monitor.rs
index 6ebcaf48a0..1c20254c37 100644
--- a/talpid-core/src/split_tunnel/windows/volume_monitor.rs
+++ b/talpid-core/src/split_tunnel/windows/volume_monitor.rs
@@ -1,20 +1,20 @@
//! Used to monitor volume mounts and dismounts, and reapply the split
//! tunnel config if any of the excluded paths are affected by them.
use super::path_monitor::PathMonitorHandle;
-use crate::window::{WindowCloseHandle, create_hidden_window};
-use futures::{StreamExt, channel::mpsc};
+use crate::window::{create_hidden_window, WindowCloseHandle};
+use futures::{channel::mpsc, StreamExt};
use std::{
ffi::OsString,
io,
path::{self, Path},
- sync::{Arc, Mutex, MutexGuard, mpsc as sync_mpsc},
+ sync::{mpsc as sync_mpsc, Arc, Mutex, MutexGuard},
};
use talpid_types::ErrorExt;
use windows_sys::Win32::{
Storage::FileSystem::GetLogicalDrives,
UI::WindowsAndMessaging::{
- DBT_DEVICEARRIVAL, DBT_DEVICEREMOVECOMPLETE, DBT_DEVTYP_VOLUME, DBTF_NET,
- DEV_BROADCAST_HDR, DEV_BROADCAST_VOLUME, DefWindowProcW, WM_DEVICECHANGE,
+ DefWindowProcW, DBTF_NET, DBT_DEVICEARRIVAL, DBT_DEVICEREMOVECOMPLETE, DBT_DEVTYP_VOLUME,
+ DEV_BROADCAST_HDR, DEV_BROADCAST_VOLUME, WM_DEVICECHANGE,
},
};
diff --git a/talpid-core/src/window.rs b/talpid-core/src/window.rs
index 6154e2719b..30df21f2da 100644
--- a/talpid-core/src/window.rs
+++ b/talpid-core/src/window.rs
@@ -3,17 +3,17 @@
use std::{os::windows::io::AsRawHandle, ptr, sync::Arc, thread};
use tokio::sync::broadcast;
use windows_sys::{
+ w,
Win32::{
Foundation::{HANDLE, HWND, LPARAM, LRESULT, WPARAM},
System::{LibraryLoader::GetModuleHandleW, Threading::GetThreadId},
UI::WindowsAndMessaging::{
- CreateWindowExW, DefWindowProcW, DestroyWindow, DispatchMessageW, GWLP_USERDATA,
- GWLP_WNDPROC, GetMessageW, GetWindowLongPtrW, PBT_APMRESUMEAUTOMATIC,
- PBT_APMRESUMESUSPEND, PBT_APMSUSPEND, PostQuitMessage, PostThreadMessageW,
- SetWindowLongPtrW, TranslateMessage, WM_DESTROY, WM_POWERBROADCAST, WM_USER,
+ CreateWindowExW, DefWindowProcW, DestroyWindow, DispatchMessageW, GetMessageW,
+ GetWindowLongPtrW, PostQuitMessage, PostThreadMessageW, SetWindowLongPtrW,
+ TranslateMessage, GWLP_USERDATA, GWLP_WNDPROC, PBT_APMRESUMEAUTOMATIC,
+ PBT_APMRESUMESUSPEND, PBT_APMSUSPEND, WM_DESTROY, WM_POWERBROADCAST, WM_USER,
},
},
- w,
};
const CLASS_NAME: *const u16 = w!("STATIC");