From e8df3d168e7fb9d6f99d97eb40eb7110bc9a4d61 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 25 Mar 2025 15:18:10 +0000 Subject: [PATCH] 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 --- crates/atuin-client/src/sync.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/atuin-client/src/sync.rs b/crates/atuin-client/src/sync.rs index 2b099ae4..ac63c2c0 100644 --- a/crates/atuin-client/src/sync.rs +++ b/crates/atuin-client/src/sync.rs @@ -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; }