feat(sdk): Simplify code by using std::cmp::min.

This commit is contained in:
Ivan Enderlin
2023-02-06 13:43:01 +01:00
parent e68134dd53
commit 5e8224f19c

View File

@@ -1426,9 +1426,7 @@ impl SlidingSyncViewRequestGenerator {
| InnerSlidingSyncViewRequestGenerator::GrowingFullSync {
position, live, limit, ..
} => {
let max = limit
.map(|limit| if limit > max_index { max_index } else { limit })
.unwrap_or(max_index);
let max = limit.map(|limit| std::cmp::min(limit, max_index)).unwrap_or(max_index);
trace!(end, max, name = self.view.name, "updating state");
if end >= max {
trace!(name = self.view.name, "going live");