refactor(sdk): Remove unused Result

This commit is contained in:
Jonas Platte
2023-01-26 12:44:19 +01:00
committed by Jonas Platte
parent d2678e2f01
commit 6d868908cb
4 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -689,7 +689,7 @@ impl SlidingSync {
})));
RUNTIME.spawn(async move {
let stream = inner.stream().unwrap();
let stream = inner.stream();
pin_mut!(stream);
loop {
let update = match stream.next().await {
+3 -3
View File
@@ -860,13 +860,13 @@ impl SlidingSync {
/// Create the inner stream for the view.
///
/// Run this stream to receive new updates from the server.
pub fn stream(&self) -> Result<impl Stream<Item = Result<UpdateSummary, crate::Error>> + '_> {
pub fn stream(&self) -> impl Stream<Item = Result<UpdateSummary, crate::Error>> + '_ {
let views = self.views.lock_ref().to_vec();
let client = self.client.clone();
debug!(?self.extensions, "Setting view stream going");
Ok(async_stream::stream! {
async_stream::stream! {
let mut remaining_views = views.clone();
let mut remaining_generators: Vec<SlidingSyncViewRequestGenerator<'_>> = views
.iter()
@@ -987,7 +987,7 @@ impl SlidingSync {
debug!("handled");
yield Ok(updates);
}
})
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ pub async fn run_client(
.cold_cache("jack-in-default")
.build()
.await?;
let stream = syncer.stream().expect("we can build the stream");
let stream = syncer.stream();
let view = syncer.views.lock_ref().first().expect("we have the full syncer there").clone();
let state = view.state.clone();
let mut ssync_state = state::SlidingSyncState::new(view);
@@ -75,7 +75,7 @@ mod tests {
async fn it_works_smoke_test() -> anyhow::Result<()> {
let (_client, sync_proxy_builder) = setup("odo".to_owned(), false).await?;
let sync_proxy = sync_proxy_builder.add_fullsync_view().build().await?;
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let room_summary =
stream.next().await.context("No room summary found, loop ended unsuccessfully")?;
@@ -109,7 +109,7 @@ mod tests {
assert!(sync_proxy.view(view_name_3).is_none());
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let room_summary =
stream.next().await.context("No room summary found, loop ended unsuccessfully")?;
@@ -120,7 +120,7 @@ mod tests {
assert!(sync_proxy.add_view(build_view(view_name_3)?).is_none());
// we need to restart the stream after every view listing update
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let mut saw_update = false;
@@ -210,7 +210,7 @@ mod tests {
bail!("but we just added that view!");
};
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let Some(room_summary ) = stream.next().await else {
bail!("No room summary found, loop ended unsuccessfully");
@@ -224,7 +224,7 @@ mod tests {
};
// we need to restart the stream after every view listing update
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
// Let's trigger an update by sending a message to room pos=3, making it move to
@@ -266,7 +266,7 @@ mod tests {
assert!(sync_proxy.add_view(view_2).is_none());
// we need to restart the stream after every view listing update
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let mut saw_update = false;
@@ -348,7 +348,7 @@ mod tests {
assert_eq!(view.state.get_cloned(), SlidingSyncState::Cold, "view isn't cold");
assert_eq!(full_view.state.get_cloned(), SlidingSyncState::Cold, "full isn't cold");
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
// exactly one poll!
@@ -422,7 +422,7 @@ mod tests {
.build()?;
let sync_proxy = sync_proxy_builder.add_view(sliding_window_view).build().await?;
let view = sync_proxy.view("sliding").context("but we just added that view!")?;
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let room_summary =
stream.next().await.context("No room summary found, loop ended unsuccessfully")?;
@@ -610,7 +610,7 @@ mod tests {
.build()?;
let sync_proxy = sync_proxy_builder.add_view(sliding_window_view).build().await?;
let view = sync_proxy.view("sliding").context("but we just added that view!")?;
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
let room_summary =
stream.next().await.context("No room summary found, loop ended unsuccessfully")?;
@@ -893,7 +893,7 @@ mod tests {
.await?;
let growing_sync =
sync_proxy.view("growing").context("but we just added that view!")?; // let's catch it up fully.
let stream = sync_proxy.stream()?;
let stream = sync_proxy.stream();
pin_mut!(stream);
while growing_sync.state.get_cloned() != SlidingSyncState::Live {
// we wait until growing sync is all done, too