diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2024-01-04 18:18:43 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2024-01-04 18:18:43 +0100 |
| commit | 2d0bad03c6e6ddf193e73fe7e17f582706b1d69d (patch) | |
| tree | f70cd8246317a272cf1f2c32cd2f4aedb6e075a7 | |
| parent | d081fab3bd95b306b432fce38c926db37f7d68b6 (diff) | |
| parent | d0ac040f21d28debd40573e814073e68e721bf1e (diff) | |
| download | mullvadvpn-2d0bad03c6e6ddf193e73fe7e17f582706b1d69d.tar.xz mullvadvpn-2d0bad03c6e6ddf193e73fe7e17f582706b1d69d.zip | |
Merge branch 'workspace-level-lints'
63 files changed, 135 insertions, 56 deletions
diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 31f97881ee..bd8d7fa796 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -64,7 +64,7 @@ jobs: RUSTFLAGS: --deny warnings run: | source env.sh - time cargo clippy --locked -- -W clippy::unused_async + time cargo clippy --locked clippy-check-android: name: Clippy linting, Android @@ -86,4 +86,4 @@ jobs: env: RUSTFLAGS: --deny warnings run: | - cargo clippy --locked --target x86_64-linux-android --package mullvad-jni -- -W clippy::unused_async + cargo clippy --locked --target x86_64-linux-android --package mullvad-jni diff --git a/Cargo.toml b/Cargo.toml index 00a797d3c2..d5db47a22a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,12 @@ members = [ "tunnel-obfuscation", ] +[workspace.lints.rust] +rust_2018_idioms = "deny" + +[workspace.lints.clippy] +unused_async = "deny" + [workspace.dependencies] tokio = { version = "1.8" } # Tonic and related crates diff --git a/android/translations-converter/Cargo.toml b/android/translations-converter/Cargo.toml index 1c3b89e1d8..ee6cd4989f 100644 --- a/android/translations-converter/Cargo.toml +++ b/android/translations-converter/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] err-derive = { workspace = true } htmlize = { version = "1.0.2", features = ["unescape"] } diff --git a/android/translations-converter/src/main.rs b/android/translations-converter/src/main.rs index 118c66d425..afb760f899 100644 --- a/android/translations-converter/src/main.rs +++ b/android/translations-converter/src/main.rs @@ -31,8 +31,6 @@ //! most cases, it is important to keep in mind that this is just a helper tool and manual steps are //! likely to be needed from time to time. -#![deny(rust_2018_idioms)] - mod android; mod gettext; mod normalize; diff --git a/ios/MullvadREST/Transport/Shadowsocks/shadowsocks-proxy/Cargo.toml b/ios/MullvadREST/Transport/Shadowsocks/shadowsocks-proxy/Cargo.toml index d4f4623c8b..1247e3200a 100644 --- a/ios/MullvadREST/Transport/Shadowsocks/shadowsocks-proxy/Cargo.toml +++ b/ios/MullvadREST/Transport/Shadowsocks/shadowsocks-proxy/Cargo.toml @@ -7,6 +7,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [lib] crate-type = [ "rlib", "staticlib" ] bench = false diff --git a/ios/TunnelObfuscation/tunnel-obfuscator-proxy/Cargo.toml b/ios/TunnelObfuscation/tunnel-obfuscator-proxy/Cargo.toml index 3608261d22..0eb3980e73 100644 --- a/ios/TunnelObfuscation/tunnel-obfuscator-proxy/Cargo.toml +++ b/ios/TunnelObfuscation/tunnel-obfuscator-proxy/Cargo.toml @@ -7,6 +7,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [lib] crate-type = [ "rlib", "staticlib" ] bench = false diff --git a/mullvad-api/Cargo.toml b/mullvad-api/Cargo.toml index 90ad8ac22d..9ff57b3fd2 100644 --- a/mullvad-api/Cargo.toml +++ b/mullvad-api/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [features] # Allow the API server to use to be configured via MULLVAD_API_HOST and MULLVAD_API_ADDR. api-override = [] diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index d9c3d9e21b..e66896a1b0 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - #[cfg(target_os = "android")] use futures::channel::mpsc; use futures::Stream; diff --git a/mullvad-cli/Cargo.toml b/mullvad-cli/Cargo.toml index 60ef5faddf..8e310dce3b 100644 --- a/mullvad-cli/Cargo.toml +++ b/mullvad-cli/Cargo.toml @@ -8,6 +8,8 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true [[bin]] name = "mullvad" diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs index 83bd283892..270d3c293e 100644 --- a/mullvad-cli/src/main.rs +++ b/mullvad-cli/src/main.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - #[cfg(all(unix, not(target_os = "android")))] use anyhow::anyhow; use anyhow::Result; diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml index 352db7d9f9..7391b268f8 100644 --- a/mullvad-daemon/Cargo.toml +++ b/mullvad-daemon/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [features] # Allow the API server to use to be configured api-override = ["mullvad-api/api-override"] diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index b429366492..f365496baf 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -1,4 +1,3 @@ -#![deny(rust_2018_idioms)] #![recursion_limit = "512"] mod access_method; diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index 12dacfad4b..80f15bb755 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - use mullvad_daemon::{ logging, management_interface::{ManagementInterfaceEventBroadcaster, ManagementInterfaceServer}, diff --git a/mullvad-exclude/Cargo.toml b/mullvad-exclude/Cargo.toml index 830a9924ff..b641fd281b 100644 --- a/mullvad-exclude/Cargo.toml +++ b/mullvad-exclude/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [target.'cfg(target_os = "linux")'.dependencies] nix = "0.23" err-derive = { workspace = true } diff --git a/mullvad-fs/Cargo.toml b/mullvad-fs/Cargo.toml index 76fbd3d7d4..e0d43888c6 100644 --- a/mullvad-fs/Cargo.toml +++ b/mullvad-fs/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] log = { workspace = true } tokio = { workspace = true, features = ["fs", "rt"] } diff --git a/mullvad-jni/Cargo.toml b/mullvad-jni/Cargo.toml index 0571a50cad..6ed3ddcadf 100644 --- a/mullvad-jni/Cargo.toml +++ b/mullvad-jni/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [features] # Allow the API server to use to be configured api-override = ["mullvad-api/api-override"] diff --git a/mullvad-jni/src/daemon_interface.rs b/mullvad-jni/src/daemon_interface.rs index feea551557..7ecc91585a 100644 --- a/mullvad-jni/src/daemon_interface.rs +++ b/mullvad-jni/src/daemon_interface.rs @@ -31,7 +31,7 @@ pub enum Error { UpdateSettings, #[error(display = "Daemon returned an error")] - OtherError(#[error(source)] mullvad_daemon::Error), + Other(#[error(source)] mullvad_daemon::Error), } impl From<mullvad_daemon::Error> for Error { @@ -44,7 +44,7 @@ impl From<mullvad_daemon::Error> for Error { mullvad_daemon::Error::ListDevicesError(device::Error::OtherRestError(error)) => { Error::Api(error) } - error => Error::OtherError(error), + error => Error::Other(error), } } } diff --git a/mullvad-jni/src/jni_event_listener.rs b/mullvad-jni/src/jni_event_listener.rs index 4e1dcff630..2aeb8320e3 100644 --- a/mullvad-jni/src/jni_event_listener.rs +++ b/mullvad-jni/src/jni_event_listener.rs @@ -34,8 +34,8 @@ enum Event { Settings(Settings), Tunnel(TunnelState), AppVersionInfo(AppVersionInfo), - DeviceEvent(DeviceEvent), - RemoveDeviceEvent(RemoveDeviceEvent), + Device(DeviceEvent), + RemoveDevice(RemoveDeviceEvent), } #[derive(Clone, Debug)] @@ -65,11 +65,11 @@ impl EventListener for JniEventListener { } fn notify_device_event(&self, event: DeviceEvent) { - let _ = self.0.send(Event::DeviceEvent(event)); + let _ = self.0.send(Event::Device(event)); } fn notify_remove_device_event(&self, event: RemoveDeviceEvent) { - let _ = self.0.send(Event::RemoveDeviceEvent(event)); + let _ = self.0.send(Event::RemoveDevice(event)); } } @@ -190,15 +190,13 @@ impl<'env> JniEventHandler<'env> { while let Ok(event) = self.events.recv() { match event { Event::RelayList(relay_list) => self.handle_relay_list_event(relay_list), - Event::Settings(settings) => self.handle_settings(settings), + Event::Settings(settings) => self.handle_settings_event(settings), Event::Tunnel(tunnel_event) => self.handle_tunnel_event(tunnel_event), Event::AppVersionInfo(app_version_info) => { self.handle_app_version_info_event(app_version_info) } - Event::DeviceEvent(device_event) => self.handle_device_event(device_event), - Event::RemoveDeviceEvent(device_event) => { - self.handle_remove_device_event(device_event) - } + Event::Device(device_event) => self.handle_device_event(device_event), + Event::RemoveDevice(device_event) => self.handle_remove_device_event(device_event), } } } @@ -258,7 +256,7 @@ impl<'env> JniEventHandler<'env> { } } - fn handle_settings(&self, settings: Settings) { + fn handle_settings_event(&self, settings: Settings) { let java_settings = settings.into_java(&self.env); let result = self.env.call_method_unchecked( diff --git a/mullvad-jni/src/lib.rs b/mullvad-jni/src/lib.rs index 8c51157896..8334ecd1ee 100644 --- a/mullvad-jni/src/lib.rs +++ b/mullvad-jni/src/lib.rs @@ -1,5 +1,4 @@ #![cfg(target_os = "android")] -#![deny(rust_2018_idioms)] mod classes; mod daemon_interface; @@ -108,7 +107,7 @@ impl From<Result<(), daemon_interface::Error>> for LoginResult { match result { Ok(()) => LoginResult::Ok, Err(error) => match error { - daemon_interface::Error::OtherError(mullvad_daemon::Error::LoginError(error)) => { + daemon_interface::Error::Other(mullvad_daemon::Error::LoginError(error)) => { match error { device::Error::InvalidAccount => LoginResult::InvalidAccount, device::Error::MaxDevicesReached => LoginResult::MaxDevicesReached, @@ -137,7 +136,7 @@ impl From<Result<(), daemon_interface::Error>> for RemoveDeviceResult { match result { Ok(()) => RemoveDeviceResult::Ok, Err(error) => match error { - daemon_interface::Error::OtherError(mullvad_daemon::Error::LoginError(error)) => { + daemon_interface::Error::Other(mullvad_daemon::Error::LoginError(error)) => { match error { device::Error::InvalidAccount => RemoveDeviceResult::RpcError, device::Error::InvalidDevice => RemoveDeviceResult::NotFound, @@ -180,10 +179,10 @@ impl From<Result<VoucherSubmission, daemon_interface::Error>> for VoucherSubmiss impl From<daemon_interface::Error> for VoucherSubmissionError { fn from(error: daemon_interface::Error) -> Self { match error { - daemon_interface::Error::OtherError(mullvad_daemon::Error::VoucherSubmission( + daemon_interface::Error::Other(mullvad_daemon::Error::VoucherSubmission( device::Error::InvalidVoucher, )) => VoucherSubmissionError::InvalidVoucher, - daemon_interface::Error::OtherError(mullvad_daemon::Error::VoucherSubmission( + daemon_interface::Error::Other(mullvad_daemon::Error::VoucherSubmission( device::Error::UsedVoucher, )) => VoucherSubmissionError::VoucherAlreadyUsed, _ => VoucherSubmissionError::OtherError, diff --git a/mullvad-management-interface/Cargo.toml b/mullvad-management-interface/Cargo.toml index dc70a47905..b83298779e 100644 --- a/mullvad-management-interface/Cargo.toml +++ b/mullvad-management-interface/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] chrono = { workspace = true } err-derive = { workspace = true } diff --git a/mullvad-nsis/Cargo.toml b/mullvad-nsis/Cargo.toml index 7bf430b208..dd6b2aa8bc 100644 --- a/mullvad-nsis/Cargo.toml +++ b/mullvad-nsis/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [lib] crate_type = ["staticlib"] diff --git a/mullvad-paths/Cargo.toml b/mullvad-paths/Cargo.toml index cacd8526a2..df8a66635a 100644 --- a/mullvad-paths/Cargo.toml +++ b/mullvad-paths/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] err-derive = { workspace = true } diff --git a/mullvad-paths/src/lib.rs b/mullvad-paths/src/lib.rs index cdbad6bc7b..4fe401016b 100644 --- a/mullvad-paths/src/lib.rs +++ b/mullvad-paths/src/lib.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - #[cfg(not(target_os = "windows"))] use std::fs; use std::{io, path::PathBuf}; diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml index 9001b4a181..d5b19d3703 100644 --- a/mullvad-problem-report/Cargo.toml +++ b/mullvad-problem-report/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] dirs = "5.0.1" err-derive = { workspace = true } diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index 10c2ec1b96..707b1d4e8b 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - use mullvad_api::proxy::ApiConnectionMode; use once_cell::sync::Lazy; use regex::Regex; diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs index 50a2e0ce18..ee1bfc7c6a 100644 --- a/mullvad-problem-report/src/main.rs +++ b/mullvad-problem-report/src/main.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - use clap::Parser; use mullvad_problem_report::{collect_report, Error}; use std::{ diff --git a/mullvad-relay-selector/Cargo.toml b/mullvad-relay-selector/Cargo.toml index aa954ba610..7cf25034bc 100644 --- a/mullvad-relay-selector/Cargo.toml +++ b/mullvad-relay-selector/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] chrono = { workspace = true } err-derive = { workspace = true } diff --git a/mullvad-setup/Cargo.toml b/mullvad-setup/Cargo.toml index 22fc63b54f..bc13c3e593 100644 --- a/mullvad-setup/Cargo.toml +++ b/mullvad-setup/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [[bin]] name = "mullvad-setup" path = "src/main.rs" diff --git a/mullvad-types/Cargo.toml b/mullvad-types/Cargo.toml index 1bc311c666..68e036e5f7 100644 --- a/mullvad-types/Cargo.toml +++ b/mullvad-types/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] chrono = { workspace = true, features = ["clock", "serde"] } err-derive = { workspace = true } diff --git a/mullvad-types/src/lib.rs b/mullvad-types/src/lib.rs index 8aefaeb400..8b8bd35fc4 100644 --- a/mullvad-types/src/lib.rs +++ b/mullvad-types/src/lib.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - pub mod access_method; pub mod account; pub mod auth_failed; diff --git a/mullvad-version/Cargo.toml b/mullvad-version/Cargo.toml index 87a1b5df68..229b858f5f 100644 --- a/mullvad-version/Cargo.toml +++ b/mullvad-version/Cargo.toml @@ -13,6 +13,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [target.'cfg(not(target_os="android"))'.dependencies] regex = "1.6.0" diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index 4a7d74e763..b7ff565293 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] err-derive = { workspace = true } futures = "0.3.15" diff --git a/talpid-core/src/lib.rs b/talpid-core/src/lib.rs index cc908bbfbe..d0b6a98b38 100644 --- a/talpid-core/src/lib.rs +++ b/talpid-core/src/lib.rs @@ -1,7 +1,6 @@ //! The core components of the talpidaemon VPN client. #![deny(missing_docs)] -#![deny(rust_2018_idioms)] #![recursion_limit = "1024"] /// Misc FFI utilities. diff --git a/talpid-dbus/Cargo.toml b/talpid-dbus/Cargo.toml index 60ab88f973..346f154a95 100644 --- a/talpid-dbus/Cargo.toml +++ b/talpid-dbus/Cargo.toml @@ -7,6 +7,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [target.'cfg(target_os = "linux")'.dependencies] dbus = "0.9" err-derive = { workspace = true } diff --git a/talpid-dbus/src/network_manager.rs b/talpid-dbus/src/network_manager.rs index ba614f0563..7cddb33981 100644 --- a/talpid-dbus/src/network_manager.rs +++ b/talpid-dbus/src/network_manager.rs @@ -454,7 +454,7 @@ impl NetworkManager { let device = self.as_path(&device_path); // Get the last applied connection - let (mut settings, version_id): (NetworkSettings, u64) = + let (mut settings, version_id): (NetworkSettings<'_>, u64) = device.method_call(NM_DEVICE, "GetAppliedConnection", (0u32,))?; // Keep changed routes. diff --git a/talpid-openvpn-plugin/Cargo.toml b/talpid-openvpn-plugin/Cargo.toml index 39315775ba..2dc6506c03 100644 --- a/talpid-openvpn-plugin/Cargo.toml +++ b/talpid-openvpn-plugin/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [lib] crate-type = ["cdylib"] diff --git a/talpid-openvpn-plugin/src/lib.rs b/talpid-openvpn-plugin/src/lib.rs index 0f9bb914a6..f35a9a5d07 100644 --- a/talpid-openvpn-plugin/src/lib.rs +++ b/talpid-openvpn-plugin/src/lib.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - use openvpn_plugin::{openvpn_plugin, EventResult, EventType}; use std::{collections::HashMap, ffi::CString, io, sync::Mutex}; use talpid_types::ErrorExt; diff --git a/talpid-openvpn/Cargo.toml b/talpid-openvpn/Cargo.toml index a348ea7486..2dfa62d321 100644 --- a/talpid-openvpn/Cargo.toml +++ b/talpid-openvpn/Cargo.toml @@ -8,6 +8,8 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true [dependencies] async-trait = "0.1" diff --git a/talpid-openvpn/src/lib.rs b/talpid-openvpn/src/lib.rs index a0c4651d13..47d1bc675a 100644 --- a/talpid-openvpn/src/lib.rs +++ b/talpid-openvpn/src/lib.rs @@ -1,7 +1,6 @@ //! Manage OpenVPN tunnels. #![deny(missing_docs)] -#![deny(rust_2018_idioms)] use crate::proxy::ProxyMonitor; #[cfg(windows)] diff --git a/talpid-platform-metadata/Cargo.toml b/talpid-platform-metadata/Cargo.toml index eca5b7b6e3..168bb2e0ba 100644 --- a/talpid-platform-metadata/Cargo.toml +++ b/talpid-platform-metadata/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [target.'cfg(target_os = "linux")'.dependencies] rs-release = "0.1.7" diff --git a/talpid-routing/Cargo.toml b/talpid-routing/Cargo.toml index 31545fe705..1844377bbd 100644 --- a/talpid-routing/Cargo.toml +++ b/talpid-routing/Cargo.toml @@ -8,6 +8,8 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true [dependencies] err-derive = { workspace = true } diff --git a/talpid-routing/src/lib.rs b/talpid-routing/src/lib.rs index f1bf28d1a2..7bb337b127 100644 --- a/talpid-routing/src/lib.rs +++ b/talpid-routing/src/lib.rs @@ -1,7 +1,6 @@ //! Manage routing tables on various platforms. #![deny(missing_docs)] -#![deny(rust_2018_idioms)] use ipnetwork::IpNetwork; use std::{fmt, net::IpAddr}; diff --git a/talpid-time/Cargo.toml b/talpid-time/Cargo.toml index 7bd49722ec..fc0effe6b9 100644 --- a/talpid-time/Cargo.toml +++ b/talpid-time/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] tokio = { workspace = true, features = ["time"] } libc = "0.2" diff --git a/talpid-tunnel-config-client/Cargo.toml b/talpid-tunnel-config-client/Cargo.toml index aed783edae..46a96828c6 100644 --- a/talpid-tunnel-config-client/Cargo.toml +++ b/talpid-tunnel-config-client/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] log = { workspace = true } rand = "0.8" diff --git a/talpid-tunnel-config-client/src/classic_mceliece.rs b/talpid-tunnel-config-client/src/classic_mceliece.rs index 780566958d..a2d5dc0be2 100644 --- a/talpid-tunnel-config-client/src/classic_mceliece.rs +++ b/talpid-tunnel-config-client/src/classic_mceliece.rs @@ -27,7 +27,7 @@ pub async fn generate_keys() -> (PublicKey<'static>, SecretKey<'static>) { } pub fn decapsulate( - secret: &SecretKey, + secret: &SecretKey<'_>, ciphertext_slice: &[u8], ) -> Result<SharedSecret<'static>, super::Error> { let ciphertext_array = diff --git a/talpid-tunnel/Cargo.toml b/talpid-tunnel/Cargo.toml index cf022f9936..e6cda3ac99 100644 --- a/talpid-tunnel/Cargo.toml +++ b/talpid-tunnel/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] err-derive = { workspace = true } cfg-if = "1.0" diff --git a/talpid-types/Cargo.toml b/talpid-types/Cargo.toml index a65dbe589b..0b3905774d 100644 --- a/talpid-types/Cargo.toml +++ b/talpid-types/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] serde = { version = "1.0", features = ["derive"] } ipnetwork = "0.16" diff --git a/talpid-types/src/lib.rs b/talpid-types/src/lib.rs index ee2c6d172a..34581f074a 100644 --- a/talpid-types/src/lib.rs +++ b/talpid-types/src/lib.rs @@ -1,5 +1,3 @@ -#![deny(rust_2018_idioms)] - #[cfg(target_os = "android")] pub mod android; pub mod net; diff --git a/talpid-windows/Cargo.toml b/talpid-windows/Cargo.toml index 0a8489879f..15bb5824dc 100644 --- a/talpid-windows/Cargo.toml +++ b/talpid-windows/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [target.'cfg(windows)'.dependencies] err-derive = { workspace = true } socket2 = { version = "0.5.3" } diff --git a/talpid-windows/src/lib.rs b/talpid-windows/src/lib.rs index 755f6b2e30..53fa172ee0 100644 --- a/talpid-windows/src/lib.rs +++ b/talpid-windows/src/lib.rs @@ -1,7 +1,6 @@ //! Interface with low-level Windows-specific bits. #![deny(missing_docs)] -#![deny(rust_2018_idioms)] #![cfg(windows)] /// I/O diff --git a/talpid-wireguard/Cargo.toml b/talpid-wireguard/Cargo.toml index f9a446a700..f50383d92b 100644 --- a/talpid-wireguard/Cargo.toml +++ b/talpid-wireguard/Cargo.toml @@ -8,6 +8,8 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true [dependencies] err-derive = { workspace = true } diff --git a/talpid-wireguard/src/lib.rs b/talpid-wireguard/src/lib.rs index 27f7b3d9a5..63f24ccb4f 100644 --- a/talpid-wireguard/src/lib.rs +++ b/talpid-wireguard/src/lib.rs @@ -1,7 +1,6 @@ //! Manage WireGuard tunnels. #![deny(missing_docs)] -#![deny(rust_2018_idioms)] use self::config::Config; use futures::future::{abortable, AbortHandle as FutureAbortHandle, BoxFuture, Future}; diff --git a/test/Cargo.toml b/test/Cargo.toml index 6eac149434..3f8e2d056e 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -6,6 +6,12 @@ members = [ "test-rpc", ] +[workspace.lints.rust] +rust_2018_idioms = "deny" + +[workspace.lints.clippy] +unused_async = "deny" + [patch.crates-io] serialport = { git = "https://github.com/mullvad/serialport-rs", rev = "1401c9d39e4a89685e3506a7160869b2c8e9ceb0" } diff --git a/test/test-manager/Cargo.toml b/test/test-manager/Cargo.toml index 9e319bdf33..5f583e8f4f 100644 --- a/test/test-manager/Cargo.toml +++ b/test/test-manager/Cargo.toml @@ -3,6 +3,9 @@ name = "test-manager" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow = { version = "1", features = ["backtrace"] } futures = { workspace = true } diff --git a/test/test-manager/src/logging.rs b/test/test-manager/src/logging.rs index c11fdf28bf..56f7401d65 100644 --- a/test/test-manager/src/logging.rs +++ b/test/test-manager/src/logging.rs @@ -79,12 +79,12 @@ impl Logger { } impl log::Log for Logger { - fn enabled(&self, metadata: &log::Metadata) -> bool { + fn enabled(&self, metadata: &log::Metadata<'_>) -> bool { let inner = self.inner.lock().unwrap(); inner.env_logger.enabled(metadata) } - fn log(&self, record: &log::Record) { + fn log(&self, record: &log::Record<'_>) { if !self.enabled(record.metadata()) { return; } diff --git a/test/test-manager/src/network_monitor.rs b/test/test-manager/src/network_monitor.rs index 7f74f0f425..c48a660ba0 100644 --- a/test/test-manager/src/network_monitor.rs +++ b/test/test-manager/src/network_monitor.rs @@ -31,7 +31,7 @@ pub struct ParsedPacket { impl PacketCodec for Codec { type Item = Option<ParsedPacket>; - fn decode(&mut self, packet: pcap::Packet) -> Self::Item { + fn decode(&mut self, packet: pcap::Packet<'_>) -> Self::Item { if self.no_frame { // skip utun header specifying an address family #[cfg(target_os = "macos")] diff --git a/test/test-manager/src/vm/update.rs b/test/test-manager/src/vm/update.rs index f2ffef0051..ccc0c9b4a3 100644 --- a/test/test-manager/src/vm/update.rs +++ b/test/test-manager/src/vm/update.rs @@ -59,7 +59,7 @@ pub fn packages(config: &VmConfig, guest_ip: std::net::IpAddr) -> Result<Update> // Pretty-printing for an `Update` action. impl fmt::Display for Update { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Update::Nothing => write!(formatter, "Nothing was updated"), Update::Logs(output) => output diff --git a/test/test-rpc/Cargo.toml b/test/test-rpc/Cargo.toml index 2814088bf7..9599585942 100644 --- a/test/test-rpc/Cargo.toml +++ b/test/test-rpc/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" description = "Supports IPC between test-runner and test-manager" +[lints] +workspace = true + [dependencies] futures = { workspace = true } tokio = { workspace = true } diff --git a/test/test-rpc/src/logging.rs b/test/test-rpc/src/logging.rs index 85f25c8060..a2156f6d9b 100644 --- a/test/test-rpc/src/logging.rs +++ b/test/test-rpc/src/logging.rs @@ -1,5 +1,6 @@ use colored::Colorize; use serde::{Deserialize, Serialize}; +use std::fmt; pub type Result<T> = std::result::Result<T, Error>; @@ -19,8 +20,8 @@ pub enum Output { Other(String), } -impl std::fmt::Display for Output { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl fmt::Display for Output { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Output::Error(s) => f.write_fmt(format_args!("{}", s.as_str().red())), Output::Warning(s) => f.write_fmt(format_args!("{}", s.as_str().yellow())), diff --git a/test/test-rpc/src/transport.rs b/test/test-rpc/src/transport.rs index 291e08eb53..6a9f8b4588 100644 --- a/test/test-rpc/src/transport.rs +++ b/test/test-rpc/src/transport.rs @@ -107,7 +107,7 @@ impl ConnectionHandle { } /// Returns a future that is notified when `reset_connected_state` is called. - pub fn notified_reset(&self) -> Notified { + pub fn notified_reset(&self) -> Notified<'_> { self.reset_notify.notified() } diff --git a/test/test-runner/Cargo.toml b/test/test-runner/Cargo.toml index 64461d76aa..6f95d2b34b 100644 --- a/test/test-runner/Cargo.toml +++ b/test/test-runner/Cargo.toml @@ -3,6 +3,9 @@ name = "test-runner" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] futures = { workspace = true } tarpc = { workspace = true } diff --git a/test/test-runner/src/logging.rs b/test/test-runner/src/logging.rs index 224c329775..98f033e13a 100644 --- a/test/test-runner/src/logging.rs +++ b/test/test-runner/src/logging.rs @@ -29,11 +29,11 @@ pub static LOGGER: Lazy<StdOutBuffer> = Lazy::new(|| { pub struct StdOutBuffer(pub Mutex<Receiver<Output>>, pub Sender<Output>); impl log::Log for StdOutBuffer { - fn enabled(&self, metadata: &Metadata) -> bool { + fn enabled(&self, metadata: &Metadata<'_>) -> bool { metadata.level() <= Level::Info } - fn log(&self, record: &Record) { + fn log(&self, record: &Record<'_>) { if self.enabled(record.metadata()) { match record.metadata().level() { Level::Error => { diff --git a/tunnel-obfuscation/Cargo.toml b/tunnel-obfuscation/Cargo.toml index fc279fd973..2a7bc8fdc3 100644 --- a/tunnel-obfuscation/Cargo.toml +++ b/tunnel-obfuscation/Cargo.toml @@ -8,6 +8,9 @@ license.workspace = true edition.workspace = true publish.workspace = true +[lints] +workspace = true + [dependencies] async-trait = "0.1" err-derive = { workspace = true } |
