From 5e51c78abb8ff29bb75b4196189a777f0e3ea8f9 Mon Sep 17 00:00:00 2001 From: Markus Pettersson Date: Thu, 28 Nov 2024 15:49:24 +0100 Subject: [PATCH 1/2] Fix clippy warnings --- mullvad-cli/src/cmds/relay.rs | 1 - mullvad-daemon/src/macos_launch_daemon.rs | 4 +- mullvad-daemon/src/migrations/v7.rs | 2 +- talpid-wireguard/src/wireguard_nt/mod.rs | 61 +++++------------------ 4 files changed, 15 insertions(+), 53 deletions(-) diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs index 4fe11b2a8f95..d0de98c27a96 100644 --- a/mullvad-cli/src/cmds/relay.rs +++ b/mullvad-cli/src/cmds/relay.rs @@ -396,7 +396,6 @@ impl Relay { } /// Get active relays which are not bridges. - async fn update_constraints(update_fn: impl FnOnce(&mut RelayConstraints)) -> Result<()> { let mut rpc = MullvadProxyClient::new().await?; let settings = rpc.get_settings().await?; diff --git a/mullvad-daemon/src/macos_launch_daemon.rs b/mullvad-daemon/src/macos_launch_daemon.rs index 3e10d94ce774..945e61828bb7 100644 --- a/mullvad-daemon/src/macos_launch_daemon.rs +++ b/mullvad-daemon/src/macos_launch_daemon.rs @@ -78,9 +78,7 @@ fn daemon_plist_url() -> Object { /// Path to the plist that defines the Mullvad launch daemon. /// It must be kept in sync with the path defined in /// `dist-assets/pkg-scripts/postinstall`. - const DAEMON_PLIST_PATH: &CStr = unsafe { - CStr::from_bytes_with_nul_unchecked(b"/Library/LaunchDaemons/net.mullvad.daemon.plist\0") - }; + const DAEMON_PLIST_PATH: &CStr = c"/Library/LaunchDaemons/net.mullvad.daemon.plist"; let nsstr_inst: Id = unsafe { msg_send![class!(NSString), alloc] }; let nsstr_inst: Id = diff --git a/mullvad-daemon/src/migrations/v7.rs b/mullvad-daemon/src/migrations/v7.rs index 56225aa7b054..47c6bf6275dd 100644 --- a/mullvad-daemon/src/migrations/v7.rs +++ b/mullvad-daemon/src/migrations/v7.rs @@ -66,7 +66,7 @@ pub struct ShadowsocksProxySettings { } // ====================================================== -/// This is a closed migration. +// This is a closed migration. /// We change bridge settings to no longer be an enum with custom and normal variants. It now is a /// struct which contains a bridge type, a normal relay constraint and optional custom constraints. diff --git a/talpid-wireguard/src/wireguard_nt/mod.rs b/talpid-wireguard/src/wireguard_nt/mod.rs index 35937bcb8c24..fefb7879e9c0 100644 --- a/talpid-wireguard/src/wireguard_nt/mod.rs +++ b/talpid-wireguard/src/wireguard_nt/mod.rs @@ -714,80 +714,45 @@ impl WgNtDll { Ok(WgNtDll { handle, func_create: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardCreateAdapter\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardCreateAdapter")?) as *const _ as *const _) }, func_close: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardCloseAdapter\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardCloseAdapter")?) as *const _ as *const _) }, func_get_adapter_luid: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardGetAdapterLUID\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardGetAdapterLUID")?) as *const _ as *const _) }, func_set_configuration: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardSetConfiguration\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardSetConfiguration")?) as *const _ as *const _) }, func_get_configuration: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardGetConfiguration\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardGetConfiguration")?) as *const _ as *const _) }, func_set_adapter_state: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardSetAdapterState\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardSetAdapterState")?) as *const _ as *const _) }, func_set_logger: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardSetLogger\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardSetLogger")?) as *const _ as *const _) }, func_set_adapter_logging: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardSetAdapterLogging\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardSetAdapterLogging")?) as *const _ as *const _) }, #[cfg(daita)] func_daita_activate: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardDaitaActivate\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardDaitaActivate")?) as *const _ as *const _) }, #[cfg(daita)] func_daita_event_data_available_event: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardDaitaEventDataAvailableEvent\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardDaitaEventDataAvailableEvent")?) as *const _ + as *const _) }, #[cfg(daita)] func_daita_receive_events: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardDaitaReceiveEvents\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardDaitaReceiveEvents")?) as *const _ as *const _) }, #[cfg(daita)] func_daita_send_action: unsafe { - *((&get_proc_fn( - handle, - CStr::from_bytes_with_nul(b"WireGuardDaitaSendAction\0").unwrap(), - )?) as *const _ as *const _) + *((&get_proc_fn(handle, c"WireGuardDaitaSendAction")?) as *const _ as *const _) }, }) } From 89891f053a5e6e8adcb817a2ca906941e8e1d378 Mon Sep 17 00:00:00 2001 From: Markus Pettersson Date: Thu, 28 Nov 2024 16:24:09 +0100 Subject: [PATCH 2/2] Pin `rustc` to `1.81` in Windows build GHA --- .github/workflows/daemon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daemon.yml b/.github/workflows/daemon.yml index 080cdee7b5d4..af840a883401 100644 --- a/.github/workflows/daemon.yml +++ b/.github/workflows/daemon.yml @@ -156,7 +156,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1.0.6 with: - toolchain: stable + toolchain: 1.81 target: i686-pc-windows-msvc default: true