diff options
| -rw-r--r-- | mullvad-api/src/availability.rs | 20 | ||||
| -rw-r--r-- | mullvad-api/src/device.rs | 13 | ||||
| -rw-r--r-- | mullvad-api/src/lib.rs | 14 | ||||
| -rw-r--r-- | mullvad-api/src/relay_list.rs | 2 | ||||
| -rw-r--r-- | mullvad-daemon/src/device/service.rs | 4 | ||||
| -rw-r--r-- | mullvad-daemon/src/relay_list/mod.rs | 2 | ||||
| -rw-r--r-- | mullvad-management-interface/src/client.rs | 4 | ||||
| -rw-r--r-- | talpid-routing/src/unix/mod.rs | 4 |
8 files changed, 39 insertions, 24 deletions
diff --git a/mullvad-api/src/availability.rs b/mullvad-api/src/availability.rs index 9d5e135c15..a8ac3aa6cf 100644 --- a/mullvad-api/src/availability.rs +++ b/mullvad-api/src/availability.rs @@ -128,11 +128,14 @@ impl ApiAvailability { self.acquire().state } - pub fn wait_for_unsuspend(&self) -> impl Future<Output = Result<(), Error>> { + pub fn wait_for_unsuspend(&self) -> impl Future<Output = Result<(), Error>> + use<> { self.wait_for_state(|state| !state.is_suspended()) } - pub fn when_bg_resumes<F: Future<Output = O>, O>(&self, task: F) -> impl Future<Output = O> { + pub fn when_bg_resumes<F: Future<Output = O>, O>( + &self, + task: F, + ) -> impl Future<Output = O> + use<F, O> { let wait_task = self.wait_for_state(|state| !state.is_background_paused()); async move { let _ = wait_task.await; @@ -140,11 +143,14 @@ impl ApiAvailability { } } - pub fn wait_background(&self) -> impl Future<Output = Result<(), Error>> { + pub fn wait_background(&self) -> impl Future<Output = Result<(), Error>> + use<> { self.wait_for_state(|state| !state.is_background_paused()) } - pub fn when_online<F: Future<Output = O>, O>(&self, task: F) -> impl Future<Output = O> { + pub fn when_online<F: Future<Output = O>, O>( + &self, + task: F, + ) -> impl Future<Output = O> + use<F, O> { let wait_task = self.wait_for_state(|state| !state.is_offline()); async move { let _ = wait_task.await; @@ -156,10 +162,10 @@ impl ApiAvailability { self.wait_for_state(|state| !state.is_offline()) } - fn wait_for_state( + fn wait_for_state<F: Fn(State) -> bool>( &self, - state_ready: impl Fn(State) -> bool, - ) -> impl Future<Output = Result<(), Error>> { + state_ready: F, + ) -> impl Future<Output = Result<(), Error>> + use<F> { let mut rx = { self.acquire().tx.subscribe() }; let handle = self.clone(); diff --git a/mullvad-api/src/device.rs b/mullvad-api/src/device.rs index 036beb731f..062c06f28b 100644 --- a/mullvad-api/src/device.rs +++ b/mullvad-api/src/device.rs @@ -36,8 +36,9 @@ impl DevicesProxy { &self, account: AccountNumber, pubkey: wireguard::PublicKey, - ) -> impl Future<Output = Result<(Device, mullvad_types::wireguard::AssociatedAddresses), rest::Error>> - { + ) -> impl Future< + Output = Result<(Device, mullvad_types::wireguard::AssociatedAddresses), rest::Error>, + > + use<> { #[derive(serde::Serialize)] struct DeviceSubmission { pubkey: wireguard::PublicKey, @@ -89,7 +90,7 @@ impl DevicesProxy { &self, account: AccountNumber, id: DeviceId, - ) -> impl Future<Output = Result<Device, rest::Error>> { + ) -> impl Future<Output = Result<Device, rest::Error>> + use<> { let service = self.handle.service.clone(); let factory = self.handle.factory.clone(); async move { @@ -104,7 +105,7 @@ impl DevicesProxy { pub fn list( &self, account: AccountNumber, - ) -> impl Future<Output = Result<Vec<Device>, rest::Error>> { + ) -> impl Future<Output = Result<Vec<Device>, rest::Error>> + use<> { let service = self.handle.service.clone(); let factory = self.handle.factory.clone(); async move { @@ -120,7 +121,7 @@ impl DevicesProxy { &self, account: AccountNumber, id: DeviceId, - ) -> impl Future<Output = Result<(), rest::Error>> { + ) -> impl Future<Output = Result<(), rest::Error>> + use<> { let service = self.handle.service.clone(); let factory = self.handle.factory.clone(); async move { @@ -138,7 +139,7 @@ impl DevicesProxy { account: AccountNumber, id: DeviceId, pubkey: wireguard::PublicKey, - ) -> impl Future<Output = Result<mullvad_types::wireguard::AssociatedAddresses, rest::Error>> + ) -> impl Future<Output = Result<mullvad_types::wireguard::AssociatedAddresses, rest::Error>> + use<> { #[derive(serde::Serialize)] struct RotateDevicePubkey { diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index a47c708b2e..997a0635c7 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -504,7 +504,7 @@ impl AccountsProxy { pub fn get_data( &self, account: AccountNumber, - ) -> impl Future<Output = Result<AccountData, rest::Error>> { + ) -> impl Future<Output = Result<AccountData, rest::Error>> + use<> { let service = self.handle.service.clone(); let factory = self.handle.factory.clone(); async move { @@ -517,7 +517,9 @@ impl AccountsProxy { } } - pub fn create_account(&self) -> impl Future<Output = Result<AccountNumber, rest::Error>> { + pub fn create_account( + &self, + ) -> impl Future<Output = Result<AccountNumber, rest::Error>> + use<> { #[derive(serde::Deserialize)] struct AccountCreationResponse { number: AccountNumber, @@ -540,7 +542,7 @@ impl AccountsProxy { &self, account: AccountNumber, voucher_code: String, - ) -> impl Future<Output = Result<VoucherSubmission, rest::Error>> { + ) -> impl Future<Output = Result<VoucherSubmission, rest::Error>> + use<> { #[derive(serde::Serialize)] struct VoucherSubmission { voucher_code: String, @@ -562,7 +564,7 @@ impl AccountsProxy { pub fn delete_account( &self, account: AccountNumber, - ) -> impl Future<Output = Result<(), rest::Error>> { + ) -> impl Future<Output = Result<(), rest::Error>> + use<> { let service = self.handle.service.clone(); let factory = self.handle.factory.clone(); @@ -629,7 +631,7 @@ impl AccountsProxy { pub fn get_www_auth_token( &self, account: AccountNumber, - ) -> impl Future<Output = Result<String, rest::Error>> { + ) -> impl Future<Output = Result<String, rest::Error>> + use<> { #[derive(serde::Deserialize)] struct AuthTokenResponse { auth_token: String, @@ -717,7 +719,7 @@ impl AppVersionProxy { app_version: AppVersion, platform: &str, platform_version: String, - ) -> impl Future<Output = Result<AppVersionResponse, rest::Error>> { + ) -> impl Future<Output = Result<AppVersionResponse, rest::Error>> + use<> { let service = self.handle.service.clone(); let path = format!("{APP_URL_PREFIX}/releases/{platform}/{app_version}"); diff --git a/mullvad-api/src/relay_list.rs b/mullvad-api/src/relay_list.rs index f1375b5f6f..f19961bc8a 100644 --- a/mullvad-api/src/relay_list.rs +++ b/mullvad-api/src/relay_list.rs @@ -32,7 +32,7 @@ impl RelayListProxy { pub fn relay_list( &self, etag: Option<String>, - ) -> impl Future<Output = Result<Option<relay_list::RelayList>, rest::Error>> { + ) -> impl Future<Output = Result<Option<relay_list::RelayList>, rest::Error>> + use<> { let service = self.handle.service.clone(); let request = self.handle.factory.get("app/v1/relays"); diff --git a/mullvad-daemon/src/device/service.rs b/mullvad-daemon/src/device/service.rs index 39fbb469f9..3ebecf0483 100644 --- a/mullvad-daemon/src/device/service.rs +++ b/mullvad-daemon/src/device/service.rs @@ -261,7 +261,9 @@ pub struct AccountService { } impl AccountService { - pub fn create_account(&self) -> impl Future<Output = Result<AccountNumber, rest::Error>> + use<> { + pub fn create_account( + &self, + ) -> impl Future<Output = Result<AccountNumber, rest::Error>> + use<> { let proxy = self.proxy.clone(); let api_handle = self.api_availability.clone(); retry_future( diff --git a/mullvad-daemon/src/relay_list/mod.rs b/mullvad-daemon/src/relay_list/mod.rs index 99fa60df57..ee5781aff0 100644 --- a/mullvad-daemon/src/relay_list/mod.rs +++ b/mullvad-daemon/src/relay_list/mod.rs @@ -166,7 +166,7 @@ impl RelayListUpdater { api_handle: ApiAvailability, proxy: RelayListProxy, tag: Option<String>, - ) -> impl Future<Output = Result<Option<RelayList>, mullvad_api::Error>> + 'static { + ) -> impl Future<Output = Result<Option<RelayList>, mullvad_api::Error>> + use<> { let download_futures = move || { let available = api_handle.wait_background(); let req = proxy.relay_list(tag.clone()); diff --git a/mullvad-management-interface/src/client.rs b/mullvad-management-interface/src/client.rs index 0b74f9d9d6..fd038cc37f 100644 --- a/mullvad-management-interface/src/client.rs +++ b/mullvad-management-interface/src/client.rs @@ -133,7 +133,9 @@ impl MullvadProxyClient { TunnelState::try_from(state).map_err(Error::InvalidResponse) } - pub async fn events_listen(&mut self) -> Result<impl Stream<Item = Result<DaemonEvent>>> { + pub async fn events_listen<'a>( + &mut self, + ) -> Result<impl Stream<Item = Result<DaemonEvent>> + 'a> { let listener = self .0 .events_listen(()) diff --git a/talpid-routing/src/unix/mod.rs b/talpid-routing/src/unix/mod.rs index 042360d520..5aedc9626e 100644 --- a/talpid-routing/src/unix/mod.rs +++ b/talpid-routing/src/unix/mod.rs @@ -332,7 +332,9 @@ impl RouteManagerHandle { /// Listen for route changes. #[cfg(target_os = "linux")] - pub async fn change_listener(&self) -> Result<impl Stream<Item = CallbackMessage>, Error> { + pub async fn change_listener( + &self, + ) -> Result<impl Stream<Item = CallbackMessage> + use<>, Error> { let (response_tx, response_rx) = oneshot::channel(); self.tx .unbounded_send(RouteManagerCommand::NewChangeListener(response_tx)) |
