diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2025-07-08 17:11:23 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2025-07-09 11:52:05 +0200 |
| commit | 126ebffd7e1f371939395c6fdbe80fd6cc8373a8 (patch) | |
| tree | 463d54be88cddba65dc261fbb77c9dd6f733b04e | |
| parent | 064fb834760b641afe536e35263dfbfd3a0bd1a9 (diff) | |
| download | mullvadvpn-126ebffd7e1f371939395c6fdbe80fd6cc8373a8.tar.xz mullvadvpn-126ebffd7e1f371939395c6fdbe80fd6cc8373a8.zip | |
Inline format arguments
37 files changed, 75 insertions, 95 deletions
diff --git a/android/translations-converter/src/android/plurals.rs b/android/translations-converter/src/android/plurals.rs index 91b2395d3a..6b6c9da06b 100644 --- a/android/translations-converter/src/android/plurals.rs +++ b/android/translations-converter/src/android/plurals.rs @@ -58,11 +58,11 @@ impl TryFrom<&Path> for PluralResources { type Error = String; fn try_from(value: &Path) -> Result<Self, Self::Error> { - let strings_file = File::open(value) - .map_err(|e| format!("Failed to open plural resources file: {}", e))?; + let strings_file = + File::open(value).map_err(|e| format!("Failed to open plural resources file: {e}"))?; quick_xml::de::from_reader(BufReader::new(strings_file)) - .map_err(|e| format!("Failed to parse plural resources file: {}", e)) + .map_err(|e| format!("Failed to parse plural resources file: {e}")) } } diff --git a/android/translations-converter/src/android/string_value.rs b/android/translations-converter/src/android/string_value.rs index d7f56de35c..31c753e3cf 100644 --- a/android/translations-converter/src/android/string_value.rs +++ b/android/translations-converter/src/android/string_value.rs @@ -94,7 +94,7 @@ impl StringValue { panic!("Parameter index is less than 1") } - write!(&mut output, "%{}$", parameter_index).expect("formatting failed"); + write!(&mut output, "%{parameter_index}$").expect("formatting failed"); } output.push_str(part); diff --git a/android/translations-converter/src/android/strings.rs b/android/translations-converter/src/android/strings.rs index 04f379e82c..e0330ab362 100644 --- a/android/translations-converter/src/android/strings.rs +++ b/android/translations-converter/src/android/strings.rs @@ -53,11 +53,11 @@ impl TryFrom<&Path> for StringResources { type Error = String; fn try_from(value: &Path) -> Result<Self, Self::Error> { - let strings_file = File::open(value) - .map_err(|e| format!("Failed to open string resources file: {}", e))?; + let strings_file = + File::open(value).map_err(|e| format!("Failed to open string resources file: {e}"))?; quick_xml::de::from_reader(BufReader::new(strings_file)) - .map_err(|e| format!("Failed to parse string resources file: {}", e)) + .map_err(|e| format!("Failed to parse string resources file: {e}")) } } diff --git a/ci/ios/test-router/raas/src/capture/cleanup.rs b/ci/ios/test-router/raas/src/capture/cleanup.rs index 13189da464..43ec07590b 100644 --- a/ci/ios/test-router/raas/src/capture/cleanup.rs +++ b/ci/ios/test-router/raas/src/capture/cleanup.rs @@ -23,7 +23,7 @@ async fn delete_old_captures_inner(dir: &Path) -> std::io::Result<()> { let path = path.clone(); delete_tasks.push(tokio::spawn(async move { if let Err(e) = fs::remove_file(&path).await { - eprintln!("Failed to delete {:?}: {}", path, e); + eprintln!("Failed to delete {path:?}: {e}"); } })); } diff --git a/installer-downloader/tests/mock.rs b/installer-downloader/tests/mock.rs index e20e5375f7..d514a06320 100644 --- a/installer-downloader/tests/mock.rs +++ b/installer-downloader/tests/mock.rs @@ -302,9 +302,7 @@ impl AppDelegate for FakeAppDelegate { } fn set_status_text(&mut self, text: &str) { - self.state - .call_log - .push(format!("set_status_text: {}", text)); + self.state.call_log.push(format!("set_status_text: {text}")); self.state.status_text = text.to_owned(); } @@ -316,7 +314,7 @@ impl AppDelegate for FakeAppDelegate { fn set_download_text(&mut self, text: &str) { self.state .call_log - .push(format!("set_download_text: {}", text)); + .push(format!("set_download_text: {text}")); self.state.download_text = text.to_owned(); } @@ -338,7 +336,7 @@ impl AppDelegate for FakeAppDelegate { fn set_download_progress(&mut self, complete: u32) { self.state .call_log - .push(format!("set_download_progress: {}", complete)); + .push(format!("set_download_progress: {complete}")); self.state.download_progress = complete; } diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index 66b40e2c5c..4acbff321c 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -139,12 +139,11 @@ impl ApiEndpoint { api_addr = env::API_ADDR_VAR, api_host = env::API_HOST_VAR ); - api.address = format!("{}:{}", host, API_PORT_DEFAULT) + api.address = format!("{host}:{API_PORT_DEFAULT}") .to_socket_addrs() .unwrap_or_else(|_| { panic!( - "Unable to resolve API IP address from host {host}:{port}", - port = API_PORT_DEFAULT, + "Unable to resolve API IP address from host {host}:{API_PORT_DEFAULT}" ) }) .next(); diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs index 91711d6f3a..4be492d15b 100644 --- a/mullvad-cli/src/cmds/account.rs +++ b/mullvad-cli/src/cmds/account.rs @@ -122,7 +122,7 @@ impl Account { if verbose { println!("{:<20}{}", "Device id:", device.device.id); println!("{:<20}{}", "Device pubkey:", device.device.pubkey); - println!("{:<20}{}", "Device created:", device.device.created,); + println!("{:<20}{}", "Device created:", device.device.created); } } DeviceState::LoggedOut => { diff --git a/mullvad-cli/src/cmds/api_access.rs b/mullvad-cli/src/cmds/api_access.rs index 74ff935f88..00a268ca7f 100644 --- a/mullvad-cli/src/cmds/api_access.rs +++ b/mullvad-cli/src/cmds/api_access.rs @@ -246,7 +246,7 @@ impl ApiAccess { .await? .get(item.as_array_index()?) .cloned() - .ok_or(anyhow!(format!("Access method {} does not exist", item))) + .ok_or(anyhow!(format!("Access method {item} does not exist"))) } } diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs index 8f6c884ad4..282dd8e397 100644 --- a/mullvad-daemon/src/management_interface.rs +++ b/mullvad-daemon/src/management_interface.rs @@ -1460,7 +1460,7 @@ fn map_split_tunnel_error(error: talpid_core::split_tunnel::Error) -> Status { match &error { Error::RegisterIps(io_error) | Error::SetConfiguration(io_error) => { if io_error.kind() == std::io::ErrorKind::NotFound { - Status::not_found(format!("{}: {}", error, io_error)) + Status::not_found(format!("{error}: {io_error}")) } else { Status::unknown(error.to_string()) } diff --git a/mullvad-encrypted-dns-proxy/examples/forwarder.rs b/mullvad-encrypted-dns-proxy/examples/forwarder.rs index 00302886a2..cfa351f3b8 100644 --- a/mullvad-encrypted-dns-proxy/examples/forwarder.rs +++ b/mullvad-encrypted-dns-proxy/examples/forwarder.rs @@ -21,7 +21,7 @@ async fn main() { .into_iter() .find(|c| c.obfuscation.is_some()) .expect("No XOR config"); - println!("Proxy config in use: {:?}", proxy_config); + println!("Proxy config in use: {proxy_config:?}"); let listener = TcpListener::bind(bind_addr) .await diff --git a/mullvad-ios/src/ephemeral_peer_proxy/ios_tcp_connection.rs b/mullvad-ios/src/ephemeral_peer_proxy/ios_tcp_connection.rs index 8e874fc95b..ee31f5a38b 100644 --- a/mullvad-ios/src/ephemeral_peer_proxy/ios_tcp_connection.rs +++ b/mullvad-ios/src/ephemeral_peer_proxy/ios_tcp_connection.rs @@ -175,7 +175,7 @@ impl AsyncWrite for IosTcpConnection { // `funcs.send_fn` must be a valid function pointer. let result = unsafe { funcs.send(tunnel_handle, socket_handle, data.as_slice()) }; if result < 0 { - Err(io::Error::other(format!("Write error: {}", result))) + Err(io::Error::other(format!("Write error: {result}"))) } else { Ok(data[..result as usize].to_vec()) } @@ -242,7 +242,7 @@ impl AsyncRead for IosTcpConnection { Ok(buffer) } - errval @ ..0 => Err(io::Error::other(format!("Read error: {}", errval))), + errval @ ..0 => Err(io::Error::other(format!("Read error: {errval}"))), 0 => Err(connection_closed_err()), } diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index 415d0d617a..2c01523dbb 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -653,7 +653,7 @@ mod tests { #[cfg(windows)] fn redacts_home_dir() { let assert_redacts_home_dir = |home_dir, test_str| { - let input = format!(r"pre {}\remaining\path post", test_str); + let input = format!(r"pre {test_str}\remaining\path post"); let actual = redact_home_dir_inner(&input, Some(PathBuf::from(home_dir))); assert_eq!(r"pre ~\remaining\path post", actual); }; diff --git a/mullvad-relay-selector/tests/relay_selector.rs b/mullvad-relay-selector/tests/relay_selector.rs index f4351450fc..c104d84015 100644 --- a/mullvad-relay-selector/tests/relay_selector.rs +++ b/mullvad-relay-selector/tests/relay_selector.rs @@ -864,7 +864,7 @@ fn test_selecting_wireguard_over_shadowsocks_extra_ips() { } => { assert!(!exit.overridden_ipv4); assert!(!exit.overridden_ipv6); - assert!(SHADOWSOCKS_RELAY_EXTRA_ADDRS.contains(&endpoint.ip()), "{} is not an additional IP", endpoint); + assert!(SHADOWSOCKS_RELAY_EXTRA_ADDRS.contains(&endpoint.ip()), "{endpoint} is not an additional IP"); } wrong_relay => panic!( "Relay selector should have picked a Wireguard relay with Shadowsocks, instead chose {wrong_relay:?}" @@ -1623,7 +1623,7 @@ fn valid_user_setting_should_yield_relay() { let post_unification_result = relay_selector.get_relay(retry_attempt, talpid_types::net::IpAvailability::Ipv4); if user_result.is_ok() { - assert!(post_unification_result.is_ok(), "Expected Post-unification query to be valid because original query {:#?} yielded a connection configuration", user_query) + assert!(post_unification_result.is_ok(), "Expected Post-unification query to be valid because original query {user_query:#?} yielded a connection configuration") } } } diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs index 192386ddec..6c33976f5e 100644 --- a/mullvad-types/src/relay_constraints.rs +++ b/mullvad-types/src/relay_constraints.rs @@ -105,7 +105,7 @@ impl From<GeographicLocationConstraint> for LocationConstraint { impl fmt::Display for LocationConstraintFormatter<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.constraint { - LocationConstraint::Location(location) => write!(f, "{}", location), + LocationConstraint::Location(location) => write!(f, "{location}"), LocationConstraint::CustomList { list_id } => self .custom_lists .iter() @@ -562,10 +562,10 @@ impl fmt::Display for WireguardConstraintsFormatter<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.constraints.port { Constraint::Any => write!(f, "any port")?, - Constraint::Only(port) => write!(f, "port {}", port)?, + Constraint::Only(port) => write!(f, "port {port}")?, } if let Constraint::Only(ip_version) = self.constraints.ip_version { - write!(f, ", {},", ip_version)?; + write!(f, ", {ip_version},")?; } if self.constraints.multihop() { let location = self.constraints.entry_location.as_ref().map(|location| { @@ -574,7 +574,7 @@ impl fmt::Display for WireguardConstraintsFormatter<'_> { custom_lists: self.custom_lists, } }); - write!(f, ", multihop entry {}", location)?; + write!(f, ", multihop entry {location}")?; } Ok(()) } @@ -743,7 +743,7 @@ impl fmt::Display for BridgeConstraintsFormatter<'_> { write!(f, " using ")?; match self.constraints.providers { Constraint::Any => write!(f, "any provider")?, - Constraint::Only(ref constraint) => write!(f, "{}", constraint)?, + Constraint::Only(ref constraint) => write!(f, "{constraint}")?, } match self.constraints.ownership { Constraint::Any => Ok(()), diff --git a/mullvad-update/mullvad-release/src/artifacts.rs b/mullvad-update/mullvad-release/src/artifacts.rs index 8617c0deaf..f70cd35ec7 100644 --- a/mullvad-update/mullvad-release/src/artifacts.rs +++ b/mullvad-update/mullvad-release/src/artifacts.rs @@ -56,7 +56,7 @@ fn derive_urls( .iter() .map(|base_url| { let url = base_url.strip_suffix("/").unwrap_or(base_url); - format!("{url}/{version}/{}", filename) + format!("{url}/{version}/{filename}") }) .collect() } diff --git a/talpid-core/build.rs b/talpid-core/build.rs index 65f7a9125e..d591cefb81 100644 --- a/talpid-core/build.rs +++ b/talpid-core/build.rs @@ -18,7 +18,7 @@ mod win { "i686-pc-windows-msvc" => format!("Win32-{}", get_build_mode()), "x86_64-pc-windows-msvc" => format!("x64-{}", get_build_mode()), "aarch64-pc-windows-msvc" => format!("ARM64-{}", get_build_mode()), - _ => panic!("unrecognized target: {}", target), + _ => panic!("unrecognized target: {target}"), }; target_dir.into() } @@ -33,12 +33,12 @@ mod win { } pub fn declare_library(env_var: &str, default_dir: &str, lib_name: &str) { - println!("cargo::rerun-if-env-changed={}", env_var); + println!("cargo::rerun-if-env-changed={env_var}"); let lib_dir = env::var_os(env_var) .map(PathBuf::from) .unwrap_or_else(|| default_windows_build_artifact_dir(default_dir)); println!("cargo::rustc-link-search={}", lib_dir.display()); - println!("cargo::rustc-link-lib=dylib={}", lib_name); + println!("cargo::rustc-link-lib=dylib={lib_name}"); } pub fn manifest_dir() -> PathBuf { diff --git a/talpid-core/src/connectivity_listener.rs b/talpid-core/src/connectivity_listener.rs index 57015fc9fe..8bba54d1cb 100644 --- a/talpid-core/src/connectivity_listener.rs +++ b/talpid-core/src/connectivity_listener.rs @@ -75,7 +75,7 @@ impl ConnectivityListener { return Err(Error::InvalidMethodResult( "MullvadVpnService", "getConnectivityListener", - format!("{:?}", value), + format!("{value:?}"), )) } }; @@ -126,7 +126,7 @@ impl ConnectivityListener { return Err(Error::InvalidMethodResult( "ConnectivityListener", "isConnected", - format!("{:?}", value), + format!("{value:?}"), )) } }; @@ -154,7 +154,7 @@ impl ConnectivityListener { value => Err(Error::InvalidMethodResult( "ConnectivityListener", "getCurrentDnsServers", - format!("{:?}", value), + format!("{value:?}"), )), } } diff --git a/talpid-core/src/dns/mod.rs b/talpid-core/src/dns/mod.rs index b3b3da1310..131344a2c0 100644 --- a/talpid-core/src/dns/mod.rs +++ b/talpid-core/src/dns/mod.rs @@ -128,7 +128,7 @@ impl ResolvedDnsConfig { if i > 0 { f.write_str(", ")?; } - write!(f, "{}", addr)?; + write!(f, "{addr}")?; } f.write_str("}") } diff --git a/talpid-core/src/firewall/windows/winfw/sys.rs b/talpid-core/src/firewall/windows/winfw/sys.rs index 3349205cf3..44631c0b54 100644 --- a/talpid-core/src/firewall/windows/winfw/sys.rs +++ b/talpid-core/src/firewall/windows/winfw/sys.rs @@ -201,7 +201,7 @@ pub extern "system" fn log_sink( &log::Record::builder() .level(level) .target(&target) - .args(format_args!("{}", managed_msg)) + .args(format_args!("{managed_msg}")) .build(), ); } diff --git a/talpid-platform-metadata/src/android.rs b/talpid-platform-metadata/src/android.rs index 1709223aa4..851c151080 100644 --- a/talpid-platform-metadata/src/android.rs +++ b/talpid-platform-metadata/src/android.rs @@ -12,16 +12,13 @@ pub fn version() -> String { get_prop("ro.product.manufacturer").unwrap_or_else(|| "Unknown brand".to_owned()); let product = get_prop("ro.product.model").unwrap_or_else(|| "Unknown model".to_owned()); - format!( - "Android {} (API: {}) - {} {}", - version, api_level, manufacturer, product - ) + format!("Android {version} (API: {api_level}) - {manufacturer} {product}") } pub fn short_version() -> String { let version = os_version(); - format!("Android {}", version) + format!("Android {version}") } fn os_version() -> String { diff --git a/talpid-platform-metadata/src/macos.rs b/talpid-platform-metadata/src/macos.rs index b4a279f0e1..97b6b14813 100644 --- a/talpid-platform-metadata/src/macos.rs +++ b/talpid-platform-metadata/src/macos.rs @@ -7,14 +7,14 @@ pub fn version() -> String { let version = MacosVersion::new() .map(|version| version.version()) .unwrap_or(String::from("N/A")); - format!("macOS {}", version) + format!("macOS {version}") } pub fn short_version() -> String { let version = MacosVersion::new() .map(|version| version.short_version()) .unwrap_or(String::from("N/A")); - format!("macOS {}", version) + format!("macOS {version}") } pub fn extra_metadata() -> impl Iterator<Item = (String, String)> { diff --git a/talpid-platform-metadata/src/windows.rs b/talpid-platform-metadata/src/windows.rs index 99e2f18b3c..ec2b7b82be 100644 --- a/talpid-platform-metadata/src/windows.rs +++ b/talpid-platform-metadata/src/windows.rs @@ -26,14 +26,14 @@ pub fn version() -> String { }) .unwrap_or_else(|_| ("N/A".to_owned(), "N/A".to_owned())); - format!("Windows {} Build {}", major, build) + format!("Windows {major} Build {build}") } pub fn short_version() -> String { let version_string = WindowsVersion::new() .map(|version| version.windows_version_string()) .unwrap_or("N/A".into()); - format!("Windows {}", version_string) + format!("Windows {version_string}") } pub fn extra_metadata() -> impl Iterator<Item = (String, String)> { diff --git a/talpid-routing/src/unix/android.rs b/talpid-routing/src/unix/android.rs index 4907d34c97..79d231b63c 100644 --- a/talpid-routing/src/unix/android.rs +++ b/talpid-routing/src/unix/android.rs @@ -231,7 +231,7 @@ fn current_network_state( return Err(JvmError::InvalidMethodResult( "MullvadVpnService", "getConnectivityListener", - format!("{:?}", value), + format!("{value:?}"), )) } }; diff --git a/talpid-routing/src/windows/default_route_monitor.rs b/talpid-routing/src/windows/default_route_monitor.rs index fd73684821..f70546fe5b 100644 --- a/talpid-routing/src/windows/default_route_monitor.rs +++ b/talpid-routing/src/windows/default_route_monitor.rs @@ -141,7 +141,7 @@ impl Drop for NotifyChangeHandle { if let Err(e) = win32_err!(unsafe { CancelMibChangeNotify2(self.0) }) { // If this callback is called after we free the context that could result in UB, in // order to avoid that we panic. - panic!("Could not cancel change notification callback: {}", e) + panic!("Could not cancel change notification callback: {e}") } } } diff --git a/talpid-tunnel/src/tun_provider/android/mod.rs b/talpid-tunnel/src/tun_provider/android/mod.rs index 590c19868a..5a4723031b 100644 --- a/talpid-tunnel/src/tun_provider/android/mod.rs +++ b/talpid-tunnel/src/tun_provider/android/mod.rs @@ -167,7 +167,7 @@ impl AndroidTunProvider { JValue::Object(result) => CreateTunResult::from_java(&env, result).into(), value => Err(Error::InvalidMethodResult( method_name, - format!("{:?}", value), + format!("{value:?}"), )), } } @@ -178,10 +178,7 @@ impl AndroidTunProvider { let error = match result { Ok(JValue::Void) => None, - Ok(value) => Some(Error::InvalidMethodResult( - "closeTun", - format!("{:?}", value), - )), + Ok(value) => Some(Error::InvalidMethodResult("closeTun", format!("{value:?}"))), Err(error) => Some(error), }; @@ -219,7 +216,7 @@ impl AndroidTunProvider { match result { JValue::Bool(0) => Err(Error::Bypass), JValue::Bool(_) => Ok(()), - value => Err(Error::InvalidMethodResult("bypass", format!("{:?}", value))), + value => Err(Error::InvalidMethodResult("bypass", format!("{value:?}"))), } } diff --git a/test/test-manager/src/container.rs b/test/test-manager/src/container.rs index 19cde03ee4..88ba7d9a6b 100644 --- a/test/test-manager/src/container.rs +++ b/test/test-manager/src/container.rs @@ -29,7 +29,7 @@ pub async fn relaunch_with_rootlesskit(vnc_port: Option<u16>) { cmd.args(std::env::args()); let status = cmd.status().await.unwrap_or_else(|e| { - panic!("failed to execute [{:?}]: {}", cmd, e); + panic!("failed to execute [{cmd:?}]: {e}"); }); std::process::exit(status.code().unwrap_or(1)); diff --git a/test/test-manager/src/logging.rs b/test/test-manager/src/logging.rs index 4f7d6e1e91..75b3d3f5cd 100644 --- a/test/test-manager/src/logging.rs +++ b/test/test-manager/src/logging.rs @@ -219,7 +219,7 @@ impl TestOutput { format!( "TEST {} RETURNED ERROR: {}", self.test_name, - format!("{:?}", e).bold() + format!("{e:?}").bold() ) .red() ); diff --git a/test/test-manager/src/run_tests.rs b/test/test-manager/src/run_tests.rs index 54e563f704..513a10be71 100644 --- a/test/test-manager/src/run_tests.rs +++ b/test/test-manager/src/run_tests.rs @@ -232,7 +232,7 @@ where output.append(&mut output_after_test); } Err(e) => { - output.push(Output::Other(format!("could not get logs: {:?}", e))); + output.push(Output::Other(format!("could not get logs: {e:?}"))); } } } diff --git a/test/test-manager/src/summary.rs b/test/test-manager/src/summary.rs index f0c0723c48..373235caf6 100644 --- a/test/test-manager/src/summary.rs +++ b/test/test-manager/src/summary.rs @@ -210,7 +210,7 @@ pub async fn print_summary_table<P: AsRef<Path>>(summary_files: &[P]) { let counter_text = if total_passed == total_tests { String::from(TestResult::PASS_STR) } else { - format!("({}/{})", total_passed, total_tests) + format!("({total_passed}/{total_tests})") }; println!( "<td style='text-align: center;'>{} {}</td>", @@ -266,7 +266,7 @@ pub async fn print_summary_table<P: AsRef<Path>>(summary_files: &[P]) { } TestResult::Pass | TestResult::Skip => (), } - println!("<td style='text-align: center;'>{}</td>", result); + println!("<td style='text-align: center;'>{result}</td>"); } // Print a summary of all OSes at the end of the table // For each test, collect the result for each platform. diff --git a/test/test-manager/src/tests/helpers.rs b/test/test-manager/src/tests/helpers.rs index 5dcb8d0d0c..aef29578d0 100644 --- a/test/test-manager/src/tests/helpers.rs +++ b/test/test-manager/src/tests/helpers.rs @@ -488,12 +488,12 @@ pub async fn wait_for_tunnel_state( let events = rpc .events_listen() .await - .map_err(|status| Error::Daemon(format!("Failed to get event stream: {}", status)))?; + .map_err(|status| Error::Daemon(format!("Failed to get event stream: {status}")))?; let state = rpc .get_tunnel_state() .await - .map_err(|error| Error::Daemon(format!("Failed to get tunnel state: {:?}", error)))?; + .map_err(|error| Error::Daemon(format!("Failed to get tunnel state: {error:?}")))?; if accept_state_fn(&state) { return Ok(state); @@ -533,10 +533,7 @@ where None => continue, }, Some(Err(status)) => { - break Err(Error::Daemon(format!( - "Failed to get next event: {}", - status - ))); + break Err(Error::Daemon(format!("Failed to get next event: {status}"))); } None => break Err(Error::Daemon(String::from("Lost daemon event stream"))), } @@ -646,7 +643,7 @@ pub async fn set_custom_endpoint( mullvad_client .set_relay_settings(RelaySettings::CustomTunnelEndpoint(custom_endpoint)) .await - .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {}", error))) + .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {error}"))) } pub async fn update_relay_constraints( @@ -1322,7 +1319,7 @@ pub async fn set_location( let mut settings = mullvad_client .get_settings() .await - .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {}", error)))?; + .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {error}")))?; settings.bridge_settings.normal.location = Constraint::Only(location_constraint.clone()); mullvad_client diff --git a/test/test-manager/src/tests/install.rs b/test/test-manager/src/tests/install.rs index 0639694986..4c0195f3a5 100644 --- a/test/test-manager/src/tests/install.rs +++ b/test/test-manager/src/tests/install.rs @@ -230,8 +230,7 @@ pub async fn test_uninstall_app( assert!( !devices.iter().any(|device| device.id == uninstalled_device), - "device id {} still exists after uninstall", - uninstalled_device, + "device id {uninstalled_device} still exists after uninstall", ); Ok(()) @@ -280,8 +279,7 @@ pub async fn test_detect_app_removal( .expect("failed to list devices"); assert!( !devices.iter().any(|device| device.id == uninstalled_device), - "device id {} still exists after uninstall", - uninstalled_device, + "device id {uninstalled_device} still exists after uninstall", ); return Ok(()); diff --git a/test/test-manager/src/tests/tunnel_state.rs b/test/test-manager/src/tests/tunnel_state.rs index 60f266721e..9b83e65ff8 100644 --- a/test/test-manager/src/tests/tunnel_state.rs +++ b/test/test-manager/src/tests/tunnel_state.rs @@ -210,8 +210,7 @@ pub async fn test_connecting_state( assert!( matches!(new_state, TunnelState::Connecting { .. }), - "failed to enter connecting state: {:?}", - new_state + "failed to enter connecting state: {new_state:?}" ); // Leak test @@ -373,7 +372,7 @@ pub async fn test_connected_state( } => { assert_eq!(*addr.ip(), relay.ipv4_addr_in); } - actual => panic!("unexpected tunnel state: {:?}", actual), + actual => panic!("unexpected tunnel state: {actual:?}"), } // Ping outside of tunnel while connected diff --git a/test/test-manager/src/vm/network/linux.rs b/test/test-manager/src/vm/network/linux.rs index f5ed523655..ef7eebeb2a 100644 --- a/test/test-manager/src/vm/network/linux.rs +++ b/test/test-manager/src/vm/network/linux.rs @@ -204,7 +204,7 @@ async fn start_dnsmasq() -> Result<DhcpProcHandle> { "-i", BRIDGE_NAME, "-F", - &format!("{},{}", TEST_SUBNET_DHCP_FIRST, TEST_SUBNET_DHCP_LAST), + &format!("{TEST_SUBNET_DHCP_FIRST},{TEST_SUBNET_DHCP_LAST}"), "--no-hosts", "--keep-in-foreground", "--log-facility=-", diff --git a/test/test-rpc/src/transport.rs b/test/test-rpc/src/transport.rs index f5f4617026..ffdefbf923 100644 --- a/test/test-rpc/src/transport.rs +++ b/test/test-rpc/src/transport.rs @@ -486,7 +486,7 @@ fn display_chain(error: impl std::error::Error) -> String { let mut s = error.to_string(); let mut error = &error as &dyn std::error::Error; while let Some(source) = error.source() { - write!(&mut s, "\nCaused by: {}", source).unwrap(); + write!(&mut s, "\nCaused by: {source}").unwrap(); error = source; } s diff --git a/test/test-runner/src/logging.rs b/test/test-runner/src/logging.rs index 6ca19c2c63..bab3693c34 100644 --- a/test/test-runner/src/logging.rs +++ b/test/test-runner/src/logging.rs @@ -76,7 +76,7 @@ pub async fn get_mullvad_app_logs() -> LogOutput { async fn read_settings_file() -> Result<String, Error> { let mut settings_path = mullvad_paths::get_default_settings_dir() - .map_err(|error| Error::Logs(format!("{}", error)))?; + .map_err(|error| Error::Logs(format!("{error}")))?; settings_path.push("settings.json"); read_truncated(&settings_path, None) .await @@ -85,10 +85,10 @@ async fn read_settings_file() -> Result<String, Error> { async fn read_log_files() -> Result<Vec<Result<LogFile, Error>>, Error> { let log_dir = - mullvad_paths::get_default_log_dir().map_err(|error| Error::Logs(format!("{}", error)))?; + mullvad_paths::get_default_log_dir().map_err(|error| Error::Logs(format!("{error}")))?; let paths = list_logs(log_dir) .await - .map_err(|error| Error::Logs(format!("{}", error)))?; + .map_err(|error| Error::Logs(format!("{error}")))?; let mut log_files = Vec::new(); for path in paths { let log_file = read_truncated(&path, Some(TRUNCATE_LOG_FILE_LINES)) diff --git a/test/test-runner/src/sys.rs b/test/test-runner/src/sys.rs index 5f461f9013..024e1153c9 100644 --- a/test/test-runner/src/sys.rs +++ b/test/test-runner/src/sys.rs @@ -505,11 +505,11 @@ pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(), let hklm = RegKey::predef(HKEY_LOCAL_MACHINE); let path = Path::new(MULLVAD_WIN_REGISTRY).join("Environment"); let (registry, _) = hklm.create_subkey(&path).map_err(|error| { - test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {}", error)) + test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {error}")) })?; for (k, v) in env { registry.set_value(k, &v).map_err(|error| { - test_rpc::Error::Registry(format!("Failed to set Environment var: {}", error)) + test_rpc::Error::Registry(format!("Failed to set Environment var: {error}")) })?; } @@ -528,12 +528,12 @@ pub fn get_system_path_var() -> Result<String, test_rpc::Error> { let key = hklm .open_subkey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment") .map_err(|error| { - test_rpc::Error::Registry(format!("Failed to open Environment subkey: {}", error)) + test_rpc::Error::Registry(format!("Failed to open Environment subkey: {error}")) })?; let path: String = key .get_value("Path") - .map_err(|error| test_rpc::Error::Registry(format!("Failed to get PATH: {}", error)))?; + .map_err(|error| test_rpc::Error::Registry(format!("Failed to get PATH: {error}")))?; Ok(path) } @@ -642,7 +642,7 @@ pub async fn get_daemon_environment() -> Result<HashMap<String, String>, test_rp tokio::task::spawn_blocking(|| -> Result<HashMap<String, String>, test_rpc::Error> { let hklm = RegKey::predef(HKEY_LOCAL_MACHINE); let key = hklm.open_subkey(MULLVAD_WIN_REGISTRY).map_err(|error| { - test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {}", error)) + test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {error}")) })?; // The Strings will be quoted (surrounded by ") when read from the registry - we should @@ -651,10 +651,9 @@ pub async fn get_daemon_environment() -> Result<HashMap<String, String>, test_rp let env = key .open_subkey("Environment") .map_err(|error| { - test_rpc::Error::Registry(format!( - "Failed to open Environment subkey: {}", - error - )) + test_rpc::Error::Registry( + format!("Failed to open Environment subkey: {error}",), + ) })? .enum_values() .filter_map(|x| x.inspect_err(|err| log::trace!("{err}")).ok()) diff --git a/wireguard-go-rs/build.rs b/wireguard-go-rs/build.rs index 8978bef7b5..f4325b6cbb 100644 --- a/wireguard-go-rs/build.rs +++ b/wireguard-go-rs/build.rs @@ -348,11 +348,7 @@ fn find_lib_exe() -> anyhow::Result<PathBuf> { Arch::Arm64 => "arm64", }; - let lib_exe_pattern = format!( - "{host}/{target}/lib.exe", - host = lib_exe_host, - target = lib_exe_target, - ); + let lib_exe_pattern = format!("{lib_exe_host}/{lib_exe_target}/lib.exe",); let path_is_lib_exe = |file: &Path| file.ends_with(&lib_exe_pattern); find_file(search_path, &path_is_lib_exe)?.context("No lib.exe relative to msbuild.exe") |
