Run clippy fix
This commit is contained in:
@@ -118,7 +118,7 @@ impl SqliteCalendarEventDao {
|
||||
}
|
||||
|
||||
fn deserialize_vector(bytes: &[u8]) -> Result<Vec<f32>, DbError> {
|
||||
if bytes.len() % 4 != 0 {
|
||||
if !bytes.len().is_multiple_of(4) {
|
||||
return Err(DbError::new(DbErrorKind::QueryError));
|
||||
}
|
||||
|
||||
@@ -218,14 +218,13 @@ impl CalendarEventDao for SqliteCalendarEventDao {
|
||||
.expect("Unable to get CalendarEventDao");
|
||||
|
||||
// Validate embedding dimensions if provided
|
||||
if let Some(ref emb) = event.embedding {
|
||||
if emb.len() != 768 {
|
||||
if let Some(ref emb) = event.embedding
|
||||
&& emb.len() != 768 {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Invalid embedding dimensions: {} (expected 768)",
|
||||
emb.len()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let embedding_bytes = event.embedding.as_ref().map(|e| Self::serialize_vector(e));
|
||||
|
||||
@@ -289,15 +288,14 @@ impl CalendarEventDao for SqliteCalendarEventDao {
|
||||
conn.transaction::<_, anyhow::Error, _>(|conn| {
|
||||
for event in events {
|
||||
// Validate embedding if provided
|
||||
if let Some(ref emb) = event.embedding {
|
||||
if emb.len() != 768 {
|
||||
if let Some(ref emb) = event.embedding
|
||||
&& emb.len() != 768 {
|
||||
log::warn!(
|
||||
"Skipping event with invalid embedding dimensions: {}",
|
||||
emb.len()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let embedding_bytes =
|
||||
event.embedding.as_ref().map(|e| Self::serialize_vector(e));
|
||||
|
||||
@@ -98,7 +98,7 @@ impl SqliteDailySummaryDao {
|
||||
}
|
||||
|
||||
fn deserialize_vector(bytes: &[u8]) -> Result<Vec<f32>, DbError> {
|
||||
if bytes.len() % 4 != 0 {
|
||||
if !bytes.len().is_multiple_of(4) {
|
||||
return Err(DbError::new(DbErrorKind::QueryError));
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ impl DailySummaryDao for SqliteDailySummaryDao {
|
||||
.bind::<diesel::sql_types::Text, _>(contact)
|
||||
.get_result::<CountResult>(conn.deref_mut())
|
||||
.map(|r| r.count)
|
||||
.map_err(|e| anyhow::anyhow!("Count query error: {:?}", e).into())
|
||||
.map_err(|e| anyhow::anyhow!("Count query error: {:?}", e))
|
||||
})
|
||||
.map_err(|_| DbError::new(DbErrorKind::QueryError))
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ impl SqliteEmbeddingDao {
|
||||
|
||||
/// Deserialize bytes from BLOB back to f32 vector
|
||||
fn deserialize_vector(bytes: &[u8]) -> Result<Vec<f32>, DbError> {
|
||||
if bytes.len() % 4 != 0 {
|
||||
if !bytes.len().is_multiple_of(4) {
|
||||
return Err(DbError::new(DbErrorKind::QueryError));
|
||||
}
|
||||
|
||||
|
||||
@@ -213,14 +213,13 @@ impl LocationHistoryDao for SqliteLocationHistoryDao {
|
||||
.expect("Unable to get LocationHistoryDao");
|
||||
|
||||
// Validate embedding dimensions if provided (rare for location data)
|
||||
if let Some(ref emb) = location.embedding {
|
||||
if emb.len() != 768 {
|
||||
if let Some(ref emb) = location.embedding
|
||||
&& emb.len() != 768 {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Invalid embedding dimensions: {} (expected 768)",
|
||||
emb.len()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let embedding_bytes = location
|
||||
.embedding
|
||||
@@ -289,15 +288,14 @@ impl LocationHistoryDao for SqliteLocationHistoryDao {
|
||||
conn.transaction::<_, anyhow::Error, _>(|conn| {
|
||||
for location in locations {
|
||||
// Validate embedding if provided (rare)
|
||||
if let Some(ref emb) = location.embedding {
|
||||
if emb.len() != 768 {
|
||||
if let Some(ref emb) = location.embedding
|
||||
&& emb.len() != 768 {
|
||||
log::warn!(
|
||||
"Skipping location with invalid embedding dimensions: {}",
|
||||
emb.len()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let embedding_bytes = location
|
||||
.embedding
|
||||
|
||||
@@ -105,7 +105,7 @@ impl SqliteSearchHistoryDao {
|
||||
}
|
||||
|
||||
fn deserialize_vector(bytes: &[u8]) -> Result<Vec<f32>, DbError> {
|
||||
if bytes.len() % 4 != 0 {
|
||||
if !bytes.len().is_multiple_of(4) {
|
||||
return Err(DbError::new(DbErrorKind::QueryError));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user