Merge pull request #539 from matrix-org/jplatte/cleanup

This commit is contained in:
Jonas Platte
2022-03-17 14:44:30 +01:00
committed by GitHub
4 changed files with 16 additions and 26 deletions

View File

@@ -142,7 +142,7 @@ matrix-sdk-test = { version = "0.4.0", path = "../matrix-sdk-test" }
mockito = "0.30.0"
serde_json = "1.0.64"
tempfile = "3.2.0"
tracing-subscriber = "0.3.7"
tracing-subscriber = { version = "0.3.7", features = ["env-filter"] }
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.tokio]

View File

@@ -697,7 +697,7 @@ impl Client {
/// ```
///
/// [`restore_login`]: #method.restore_login
#[instrument(skip(user, password))]
#[instrument(skip(self, user, password))]
pub async fn login(
&self,
user: impl AsRef<str>,
@@ -985,7 +985,7 @@ impl Client {
///
/// [`get_sso_login_url`]: #method.get_sso_login_url
/// [`restore_login`]: #method.restore_login
#[instrument(skip(token))]
#[instrument(skip(self, token))]
#[cfg_attr(not(target_arch = "wasm32"), deny(clippy::future_not_send))]
pub async fn login_with_token(
&self,
@@ -1128,7 +1128,7 @@ impl Client {
/// client.register(request).await;
/// # })
/// ```
#[instrument(skip(registration))]
#[instrument(skip_all)]
pub async fn register(
&self,
registration: impl Into<register::v3::Request<'_>>,
@@ -1177,15 +1177,10 @@ impl Client {
/// # let homeserver = Url::parse("http://example.com").unwrap();
/// # let client = Client::new(homeserver).await.unwrap();
/// let mut filter = FilterDefinition::default();
/// let mut room_filter = RoomFilter::default();
/// let mut event_filter = RoomEventFilter::default();
///
/// // Let's enable member lazy loading.
/// event_filter.lazy_load_options = LazyLoadOptions::Enabled {
/// include_redundant_members: false,
/// };
/// room_filter.state = event_filter;
/// filter.room = room_filter;
/// filter.room.state.lazy_load_options =
/// LazyLoadOptions::Enabled { include_redundant_members: false };
///
/// let filter_id = client
/// .get_or_upload_filter("sync", filter)
@@ -1666,7 +1661,7 @@ impl Client {
/// [`get_or_upload_filter()`]: #method.get_or_upload_filter
/// [long polling]: #long-polling
/// [filtered]: #filtering-events
#[instrument]
#[instrument(skip(self))]
pub async fn sync_once(
&self,
sync_settings: crate::config::SyncSettings<'_>,
@@ -1680,7 +1675,7 @@ impl Client {
#[cfg(feature = "encryption")]
if let Err(e) = self.send_outgoing_requests().await {
error!(error =? e, "Error while sending outgoing E2EE requests");
};
}
let request = assign!(sync_events::v3::Request::new(), {
filter: sync_settings.filter.as_ref(),
@@ -1701,7 +1696,7 @@ impl Client {
#[cfg(feature = "encryption")]
if let Err(e) = self.send_outgoing_requests().await {
error!(error =? e, "Error while sending outgoing E2EE requests");
};
}
self.inner.sync_beat.notify(usize::MAX);
@@ -1815,7 +1810,7 @@ impl Client {
/// .await;
/// })
/// ```
#[instrument(skip(callback))]
#[instrument(skip(self, callback))]
pub async fn sync_with_callback<C>(
&self,
mut sync_settings: crate::config::SyncSettings<'_>,
@@ -1885,7 +1880,7 @@ impl Client {
///
/// # Result::<_, matrix_sdk::Error>::Ok(()) });
/// ```
#[instrument]
#[instrument(skip(self))]
pub async fn sync_stream<'a>(
&'a self,
mut sync_settings: crate::config::SyncSettings<'a>,

View File

@@ -29,12 +29,7 @@ pub struct SyncSettings<'a> {
impl<'a> Default for SyncSettings<'a> {
fn default() -> Self {
Self {
filter: Default::default(),
timeout: Some(DEFAULT_SYNC_TIMEOUT),
token: Default::default(),
full_state: Default::default(),
}
Self::new()
}
}
@@ -42,7 +37,7 @@ impl<'a> SyncSettings<'a> {
/// Create new default sync settings.
#[must_use]
pub fn new() -> Self {
Default::default()
Self { filter: None, timeout: Some(DEFAULT_SYNC_TIMEOUT), token: None, full_state: false }
}
/// Set the sync token.

View File

@@ -95,7 +95,7 @@ impl Client {
///
/// Panics if no key query needs to be done.
#[cfg(feature = "encryption")]
#[instrument]
#[instrument(skip(self))]
pub(crate) async fn keys_query(
&self,
request_id: &TransactionId,
@@ -313,7 +313,7 @@ impl Client {
///
/// * `users` - The list of user/device pairs that we should claim keys for.
#[cfg(feature = "encryption")]
#[instrument(skip(users))]
#[instrument(skip_all)]
pub(crate) async fn claim_one_time_keys(
&self,
users: impl Iterator<Item = &UserId>,
@@ -338,7 +338,7 @@ impl Client {
/// Panics if the client isn't logged in, or if no encryption keys need to
/// be uploaded.
#[cfg(feature = "encryption")]
#[instrument]
#[instrument(skip(self, request))]
pub(crate) async fn keys_upload(
&self,
request_id: &TransactionId,