aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorchitao1234 <chotaotao1qaz2wsx@gmail.com>2025-09-15 12:03:09 +0800
committerEllie Huxtable <ellie@elliehuxtable.com>2025-09-15 10:31:09 -0700
commit2ddf9349ef5258498ca5ca43e9852fefeb038f8c (patch)
tree8126ced19c5a9b560c44a5fbd59425c321c9bfc4 /crates
parentfeat: add session-preload filter mode to include global history from before s... (diff)
downloadatuin-2ddf9349ef5258498ca5ca43e9852fefeb038f8c.zip
fix: clippy warnings
Diffstat (limited to 'crates')
-rw-r--r--crates/atuin-client/src/database.rs10
-rw-r--r--crates/atuin/src/command/client/search/engines/skim.rs44
2 files changed, 22 insertions, 32 deletions
diff --git a/crates/atuin-client/src/database.rs b/crates/atuin-client/src/database.rs
index 3c88350f..82644182 100644
--- a/crates/atuin-client/src/database.rs
+++ b/crates/atuin-client/src/database.rs
@@ -77,11 +77,11 @@ pub fn current_context() -> Context {
}
fn get_session_start_time(session_id: &str) -> Option<i64> {
- if let Ok(uuid) = Uuid::parse_str(session_id) {
- if let Some(timestamp) = uuid.get_timestamp() {
- let (seconds, nanos) = timestamp.to_unix();
- return Some(seconds as i64 * 1_000_000_000 + nanos as i64);
- }
+ if let Ok(uuid) = Uuid::parse_str(session_id)
+ && let Some(timestamp) = uuid.get_timestamp()
+ {
+ let (seconds, nanos) = timestamp.to_unix();
+ return Some(seconds as i64 * 1_000_000_000 + nanos as i64);
}
None
}
diff --git a/crates/atuin/src/command/client/search/engines/skim.rs b/crates/atuin/src/command/client/search/engines/skim.rs
index dcf06e61..1af49574 100644
--- a/crates/atuin/src/command/client/search/engines/skim.rs
+++ b/crates/atuin/src/command/client/search/engines/skim.rs
@@ -48,6 +48,7 @@ impl SearchEngine for Search {
}
}
+#[allow(clippy::too_many_lines)]
async fn fuzzy_search(
engine: &SkimMatcherV2,
state: &SearchState,
@@ -95,36 +96,25 @@ async fn fuzzy_search(
};
if !is_current_session {
- let uuid = match uuid::Uuid::parse_str(&context.session) {
- Ok(uuid) => uuid,
- Err(_) => {
- log::warn!("failed to parse session id '{}'", context.session);
- continue;
- }
+ let Ok(uuid) = uuid::Uuid::parse_str(&context.session) else {
+ log::warn!("failed to parse session id '{}'", context.session);
+ continue;
};
- let timestamp = match uuid.get_timestamp() {
- Some(timestamp) => timestamp,
- None => {
- log::warn!(
- "failed to get timestamp from uuid '{}'",
- uuid.as_hyphenated()
- );
- continue;
- }
+ let Some(timestamp) = uuid.get_timestamp() else {
+ log::warn!(
+ "failed to get timestamp from uuid '{}'",
+ uuid.as_hyphenated()
+ );
+ continue;
};
let (seconds, nanos) = timestamp.to_unix();
- let session_start = match time::OffsetDateTime::from_unix_timestamp_nanos(
- seconds as i128 * 1_000_000_000 + nanos as i128,
- ) {
- Ok(session_start) => session_start,
- Err(_) => {
- log::warn!(
- "failed to create OffsetDateTime from second: {}, nanosecond: {}",
- seconds,
- nanos
- );
- continue;
- }
+ let Ok(session_start) = time::OffsetDateTime::from_unix_timestamp_nanos(
+ i128::from(seconds) * 1_000_000_000 + i128::from(nanos),
+ ) else {
+ log::warn!(
+ "failed to create OffsetDateTime from second: {seconds}, nanosecond: {nanos}"
+ );
+ continue;
};
if history.timestamp >= session_start {