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,12 +77,12 @@ 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() {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -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(_) => {
|
||||
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 => {
|
||||
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(_) => {
|
||||
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: {}, nanosecond: {}",
|
||||
seconds,
|
||||
nanos
|
||||
"failed to create OffsetDateTime from second: {seconds}, nanosecond: {nanos}"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
if history.timestamp >= session_start {
|
||||
|
||||
Reference in New Issue
Block a user