mirror of
https://github.com/atuinsh/atuin.git
synced 2025-12-14 20:35:55 +01:00
fix: clippy warnings
This commit is contained in:
committed by
Ellie Huxtable
parent
0aedb4ddd9
commit
2ddf9349ef
@@ -77,11 +77,11 @@ pub fn current_context() -> Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_session_start_time(session_id: &str) -> Option<i64> {
|
fn get_session_start_time(session_id: &str) -> Option<i64> {
|
||||||
if let Ok(uuid) = Uuid::parse_str(session_id) {
|
if let Ok(uuid) = Uuid::parse_str(session_id)
|
||||||
if let Some(timestamp) = uuid.get_timestamp() {
|
&& let Some(timestamp) = uuid.get_timestamp()
|
||||||
let (seconds, nanos) = timestamp.to_unix();
|
{
|
||||||
return Some(seconds as i64 * 1_000_000_000 + nanos as i64);
|
let (seconds, nanos) = timestamp.to_unix();
|
||||||
}
|
return Some(seconds as i64 * 1_000_000_000 + nanos as i64);
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ impl SearchEngine for Search {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_lines)]
|
||||||
async fn fuzzy_search(
|
async fn fuzzy_search(
|
||||||
engine: &SkimMatcherV2,
|
engine: &SkimMatcherV2,
|
||||||
state: &SearchState,
|
state: &SearchState,
|
||||||
@@ -95,36 +96,25 @@ async fn fuzzy_search(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if !is_current_session {
|
if !is_current_session {
|
||||||
let uuid = match uuid::Uuid::parse_str(&context.session) {
|
let Ok(uuid) = uuid::Uuid::parse_str(&context.session) else {
|
||||||
Ok(uuid) => uuid,
|
log::warn!("failed to parse session id '{}'", context.session);
|
||||||
Err(_) => {
|
continue;
|
||||||
log::warn!("failed to parse session id '{}'", context.session);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let timestamp = match uuid.get_timestamp() {
|
let Some(timestamp) = uuid.get_timestamp() else {
|
||||||
Some(timestamp) => timestamp,
|
log::warn!(
|
||||||
None => {
|
"failed to get timestamp from uuid '{}'",
|
||||||
log::warn!(
|
uuid.as_hyphenated()
|
||||||
"failed to get timestamp from uuid '{}'",
|
);
|
||||||
uuid.as_hyphenated()
|
continue;
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let (seconds, nanos) = timestamp.to_unix();
|
let (seconds, nanos) = timestamp.to_unix();
|
||||||
let session_start = match time::OffsetDateTime::from_unix_timestamp_nanos(
|
let Ok(session_start) = time::OffsetDateTime::from_unix_timestamp_nanos(
|
||||||
seconds as i128 * 1_000_000_000 + nanos as i128,
|
i128::from(seconds) * 1_000_000_000 + i128::from(nanos),
|
||||||
) {
|
) else {
|
||||||
Ok(session_start) => session_start,
|
log::warn!(
|
||||||
Err(_) => {
|
"failed to create OffsetDateTime from second: {seconds}, nanosecond: {nanos}"
|
||||||
log::warn!(
|
);
|
||||||
"failed to create OffsetDateTime from second: {}, nanosecond: {}",
|
continue;
|
||||||
seconds,
|
|
||||||
nanos
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if history.timestamp >= session_start {
|
if history.timestamp >= session_start {
|
||||||
|
|||||||
Reference in New Issue
Block a user