diff options
| author | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2024-04-08 10:50:43 +0200 |
|---|---|---|
| committer | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2024-04-09 11:03:32 +0200 |
| commit | 8eea4eae01061fb76ce1aac45ea296f60867b62c (patch) | |
| tree | 09455ab30579abdf1b30b9038a7626f6d280fc11 /test/test-runner | |
| parent | 88bba34062f1efccafa52578d56601a97f8e5e2b (diff) | |
| download | mullvadvpn-8eea4eae01061fb76ce1aac45ea296f60867b62c.tar.xz mullvadvpn-8eea4eae01061fb76ce1aac45ea296f60867b62c.zip | |
Run `cargo +nightly fmt`
Diffstat (limited to 'test/test-runner')
| -rw-r--r-- | test/test-runner/src/forward.rs | 15 | ||||
| -rw-r--r-- | test/test-runner/src/logging.rs | 9 | ||||
| -rw-r--r-- | test/test-runner/src/sys.rs | 39 |
3 files changed, 33 insertions, 30 deletions
diff --git a/test/test-runner/src/forward.rs b/test/test-runner/src/forward.rs index ec9e8a98f1..a4c80ae189 100644 --- a/test/test-runner/src/forward.rs +++ b/test/test-runner/src/forward.rs @@ -1,11 +1,14 @@ use once_cell::sync::Lazy; -use std::collections::HashMap; -use std::net::SocketAddr; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::sync::{Arc, Mutex}; +use std::{ + collections::HashMap, + net::SocketAddr, + sync::{ + atomic::{AtomicUsize, Ordering}, + Arc, Mutex, + }, +}; use test_rpc::net::SockHandleId; -use tokio::net::TcpListener; -use tokio::net::TcpStream; +use tokio::net::{TcpListener, TcpStream}; static SERVERS: Lazy<Mutex<HashMap<SockHandleId, Handle>>> = Lazy::new(|| Mutex::new(HashMap::new())); diff --git a/test/test-runner/src/logging.rs b/test/test-runner/src/logging.rs index 98f033e13a..ffe21de985 100644 --- a/test/test-runner/src/logging.rs +++ b/test/test-runner/src/logging.rs @@ -1,9 +1,10 @@ use log::{Level, LevelFilter, Metadata, Record, SetLoggerError}; use once_cell::sync::Lazy; -use std::ffi::OsStr; -use std::path::{Path, PathBuf}; -use test_rpc::logging::Error; -use test_rpc::logging::{LogFile, LogOutput, Output}; +use std::{ + ffi::OsStr, + path::{Path, PathBuf}, +}; +use test_rpc::logging::{Error, LogFile, LogOutput, Output}; use tokio::{ fs::File, io::{self, AsyncBufReadExt, BufReader}, diff --git a/test/test-runner/src/sys.rs b/test/test-runner/src/sys.rs index 7576c64e89..5015f26ca1 100644 --- a/test/test-runner/src/sys.rs +++ b/test/test-runner/src/sys.rs @@ -1,8 +1,7 @@ use std::collections::HashMap; #[cfg(target_os = "windows")] use std::io; -use test_rpc::meta::OsVersion; -use test_rpc::mullvad_daemon::Verbosity; +use test_rpc::{meta::OsVersion, mullvad_daemon::Verbosity}; #[cfg(target_os = "windows")] use std::ffi::OsString; @@ -14,11 +13,13 @@ use windows_service::{ #[cfg(target_os = "windows")] pub fn reboot() -> Result<(), test_rpc::Error> { - use windows_sys::Win32::System::Shutdown::{ - ExitWindowsEx, EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED, SHTDN_REASON_MAJOR_APPLICATION, - SHTDN_REASON_MINOR_OTHER, + use windows_sys::Win32::{ + System::Shutdown::{ + ExitWindowsEx, EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED, SHTDN_REASON_MAJOR_APPLICATION, + SHTDN_REASON_MINOR_OTHER, + }, + UI::WindowsAndMessaging::EWX_FORCEIFHUNG, }; - use windows_sys::Win32::UI::WindowsAndMessaging::EWX_FORCEIFHUNG; grant_shutdown_privilege()?; @@ -52,18 +53,17 @@ pub fn reboot() -> Result<(), test_rpc::Error> { #[cfg(target_os = "windows")] fn grant_shutdown_privilege() -> Result<(), test_rpc::Error> { - use windows_sys::Win32::Foundation::CloseHandle; - use windows_sys::Win32::Foundation::HANDLE; - use windows_sys::Win32::Foundation::LUID; - use windows_sys::Win32::Security::AdjustTokenPrivileges; - use windows_sys::Win32::Security::LookupPrivilegeValueW; - use windows_sys::Win32::Security::LUID_AND_ATTRIBUTES; - use windows_sys::Win32::Security::SE_PRIVILEGE_ENABLED; - use windows_sys::Win32::Security::TOKEN_ADJUST_PRIVILEGES; - use windows_sys::Win32::Security::TOKEN_PRIVILEGES; - use windows_sys::Win32::System::SystemServices::SE_SHUTDOWN_NAME; - use windows_sys::Win32::System::Threading::GetCurrentProcess; - use windows_sys::Win32::System::Threading::OpenProcessToken; + use windows_sys::Win32::{ + Foundation::{CloseHandle, HANDLE, LUID}, + Security::{ + AdjustTokenPrivileges, LookupPrivilegeValueW, LUID_AND_ATTRIBUTES, + SE_PRIVILEGE_ENABLED, TOKEN_ADJUST_PRIVILEGES, TOKEN_PRIVILEGES, + }, + System::{ + SystemServices::SE_SHUTDOWN_NAME, + Threading::{GetCurrentProcess, OpenProcessToken}, + }, + }; let mut privileges = TOKEN_PRIVILEGES { PrivilegeCount: 1, @@ -458,8 +458,7 @@ pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(), #[cfg(target_os = "windows")] pub fn get_system_path_var() -> Result<String, test_rpc::Error> { - use winreg::enums::*; - use winreg::*; + use winreg::{enums::*, *}; let hklm = RegKey::predef(HKEY_LOCAL_MACHINE); let key = hklm |
