Skip to content

Commit

Permalink
chore: Make Clippy happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jan 29, 2024
1 parent f94b30f commit 36775c8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/matrix-sdk-indexeddb/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pin_project! {
// When asking for the next cursor, the [`IdbCursorWithValue::continue_cursor`]
// method has to be called. It's an async method. Thus, in the `Stream`
// implementation of `Self`, this future must be stored to be polled manually.
continue_cursor_future: Option<Pin<Box<dyn Future<Output = Result<bool, DomException>> + 'a>>>,
continue_cursor_future: Option<ContinueCursorFuture<'a>>,

// The cursor API is designed in a way that the first item is already fetched
// when the cursor is created. Because `Stream::poll_next` is designed the other
Expand All @@ -82,6 +82,9 @@ pin_project! {
}
}

/// Just a type alias to a “complex type”.
type ContinueCursorFuture<'a> = Pin<Box<dyn Future<Output = Result<bool, DomException>> + 'a>>;

impl<'a> StreamByCursor<'a> {
/// Build a new `StreamByCursor`.
///
Expand Down Expand Up @@ -144,10 +147,7 @@ impl<'a> Stream for StreamByCursor<'a> {
// `continue_cursor_future` can be dropped.
*this.continue_cursor_future = None;

Poll::Ready(Some(Ok((
cursor.key().unwrap_or_else(|| JsValue::UNDEFINED),
cursor.value(),
))))
Poll::Ready(Some(Ok((cursor.key().unwrap_or(JsValue::UNDEFINED), cursor.value()))))
} else {
// It doesn't have a new value. End of the cursor. End of the stream.
Poll::Ready(None)
Expand Down Expand Up @@ -387,7 +387,7 @@ where

// Get a new `cursor_future`.
let object_store_ref = unsafe { this.latest_object_store_ptr.as_ref() };
let after_latest_key = IdbKeyRange::lower_bound_with_open(&this.latest_key, true)?;
let after_latest_key = IdbKeyRange::lower_bound_with_open(this.latest_key, true)?;
let cursor_future =
object_store_ref.as_ref().unwrap().open_cursor_with_range(&after_latest_key)?;

Expand Down

0 comments on commit 36775c8

Please sign in to comment.