fix: typeerror in client sync code (#2647)

* fix: typeerror in client sync code

Fixes #2645

This is really weird

1. I have not touched this code in _years_. It has not changed. In
   recent rust versions, it has a typeerror (see linked issue)
2. This does not occur when running `cargo build`, in release mode or
   otherwise. It only occurs with `cargo install`
3. I can't find any other occurences of this typeerror online - unsure
   if it is a compiler regression? The code here is not very complex at
    all.

* chore(clippy): remove unused imports
This commit is contained in:
Ellie Huxtable
2025-03-25 15:18:10 +00:00
committed by GitHub
parent cf9efd84cb
commit e8df3d168e

View File

@@ -1,5 +1,4 @@
use std::collections::HashSet;
use std::convert::TryInto;
use std::iter::FromIterator;
use eyre::Result;
@@ -85,8 +84,9 @@ async fn sync_download(
db.save_bulk(&history).await?;
local_count = db.history_count(true).await?;
let remote_page_size = std::cmp::max(remote_status.page_size, 0) as usize;
if history.len() < remote_status.page_size.try_into().unwrap() {
if history.len() < remote_page_size {
break;
}