Skip to content

Commit 642c4f5

Browse files
committed
Ensure Client::login_with_sso() to be send
This removes the `info!()` log because of rust-lang/rust#93274
1 parent 89e4d47 commit 642c4f5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

crates/matrix-sdk/src/client.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -925,17 +925,18 @@ impl Client {
925925
/// [`login_with_token`]: #method.login_with_token
926926
/// [`restore_login`]: #method.restore_login
927927
#[cfg(all(feature = "sso_login", not(target_arch = "wasm32")))]
928+
#[deny(clippy::future_not_send)]
928929
pub async fn login_with_sso<C>(
929930
&self,
930-
use_sso_login_url: impl Fn(String) -> C,
931+
use_sso_login_url: impl FnOnce(String) -> C + Send,
931932
server_url: Option<&str>,
932933
server_response: Option<&str>,
933934
device_id: Option<&str>,
934935
initial_device_display_name: Option<&str>,
935936
idp_id: Option<&str>,
936937
) -> Result<login::v3::Response>
937938
where
938-
C: Future<Output = Result<()>>,
939+
C: Future<Output = Result<()>> + Send,
939940
{
940941
use std::{
941942
collections::HashMap,
@@ -951,7 +952,6 @@ impl Client {
951952
/// The number of times the SSO server will try to bind to a random port
952953
const SSO_SERVER_BIND_TRIES: u8 = 10;
953954

954-
info!("Logging in to {}", self.homeserver().await);
955955
let (signal_tx, signal_rx) = tokio::sync::oneshot::channel();
956956
let (data_tx, data_rx) = tokio::sync::oneshot::channel();
957957
let data_tx_mutex = Arc::new(std::sync::Mutex::new(Some(data_tx)));
@@ -992,10 +992,9 @@ impl Client {
992992
let mut n = 0u8;
993993
let mut port = 0u16;
994994
let mut res = Err(IoError::new(IoErrorKind::Other, ""));
995-
let mut rng = thread_rng();
996995

997996
while res.is_err() && n < SSO_SERVER_BIND_TRIES {
998-
port = rng.gen_range(SSO_SERVER_BIND_RANGE);
997+
port = thread_rng().gen_range(SSO_SERVER_BIND_RANGE);
999998
res = tokio::net::TcpListener::bind((host, port)).await;
1000999
n += 1;
10011000
}
@@ -1102,14 +1101,13 @@ impl Client {
11021101
/// [`get_sso_login_url`]: #method.get_sso_login_url
11031102
/// [`restore_login`]: #method.restore_login
11041103
#[instrument(skip(token))]
1104+
#[deny(clippy::future_not_send)]
11051105
pub async fn login_with_token(
11061106
&self,
11071107
token: &str,
11081108
device_id: Option<&str>,
11091109
initial_device_display_name: Option<&str>,
11101110
) -> Result<login::v3::Response> {
1111-
info!("Logging in to {}", self.homeserver().await);
1112-
11131111
let request = assign!(
11141112
login::v3::Request::new(
11151113
login::v3::LoginInfo::Token(login::v3::Token::new(token)),

0 commit comments

Comments
 (0)