aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/atuin-ai/src/commands/inline.rs6
-rw-r--r--crates/atuin-ai/src/tui/components/markdown.rs8
-rw-r--r--crates/atuin-history/src/stats.rs26
-rw-r--r--crates/atuin/src/command/client/doctor.rs3
-rw-r--r--crates/atuin/src/command/client/dotfiles/alias.rs4
-rw-r--r--crates/atuin/src/command/client/dotfiles/var.rs4
-rw-r--r--crates/atuin/src/command/client/import.rs2
-rw-r--r--crates/atuin/src/command/client/search/inspector.rs2
-rw-r--r--crates/atuin/src/command/client/search/interactive.rs2
-rw-r--r--crates/atuin/src/command/client/wrapped.rs2
10 files changed, 24 insertions, 35 deletions
diff --git a/crates/atuin-ai/src/commands/inline.rs b/crates/atuin-ai/src/commands/inline.rs
index 6d9628ea..b7aae51f 100644
--- a/crates/atuin-ai/src/commands/inline.rs
+++ b/crates/atuin-ai/src/commands/inline.rs
@@ -326,10 +326,8 @@ fn prompt_ai_setup() -> Result<SetupChoice> {
KeyCode::Up | KeyCode::Char('k') => {
selected = selected.saturating_sub(1);
}
- KeyCode::Down | KeyCode::Char('j') => {
- if selected < options.len() - 1 {
- selected += 1;
- }
+ KeyCode::Down | KeyCode::Char('j') if selected < options.len() - 1 => {
+ selected += 1;
}
KeyCode::Enter => break,
KeyCode::Esc => {
diff --git a/crates/atuin-ai/src/tui/components/markdown.rs b/crates/atuin-ai/src/tui/components/markdown.rs
index f164fdc5..607520b7 100644
--- a/crates/atuin-ai/src/tui/components/markdown.rs
+++ b/crates/atuin-ai/src/tui/components/markdown.rs
@@ -196,11 +196,9 @@ fn parse_markdown<'a>(source: &'a str, styles: &'a MarkdownStyles) -> Text<'stat
Event::End(TagEnd::Item) => {
in_list_item = false;
}
- Event::Start(Tag::List(_)) => {
- if current_line > 0 || !lines[0].is_empty() {
- current_line += 1;
- lines.push(Vec::new());
- }
+ Event::Start(Tag::List(_)) if current_line > 0 || !lines[0].is_empty() => {
+ current_line += 1;
+ lines.push(Vec::new());
}
Event::End(TagEnd::List(_)) => {}
_ => {}
diff --git a/crates/atuin-history/src/stats.rs b/crates/atuin-history/src/stats.rs
index 8bf03e42..fedb1487 100644
--- a/crates/atuin-history/src/stats.rs
+++ b/crates/atuin-history/src/stats.rs
@@ -79,25 +79,19 @@ fn split_at_pipe(command: &str) -> Vec<&str> {
while let Some((i, c)) = graphemes.next() {
let current = i;
match c {
- "\"" => {
- if command[start..current] != *"\"" {
- quoted = !quoted;
- }
+ "\"" if command[start..current] != *"\"" => {
+ quoted = !quoted;
}
- "'" => {
- if command[start..current] != *"'" {
- quoted = !quoted;
- }
+ "'" if command[start..current] != *"'" => {
+ quoted = !quoted;
}
- "\\" => if graphemes.next().is_some() {},
- "|" => {
- if !quoted {
- if current > start && command[start..].starts_with('|') {
- start += 1;
- }
- result.push(&command[start..current]);
- start = current;
+ "\\" if graphemes.next().is_some() => {}
+ "|" if !quoted => {
+ if current > start && command[start..].starts_with('|') {
+ start += 1;
}
+ result.push(&command[start..current]);
+ start = current;
}
_ => {}
}
diff --git a/crates/atuin/src/command/client/doctor.rs b/crates/atuin/src/command/client/doctor.rs
index eea302b8..ce65f66a 100644
--- a/crates/atuin/src/command/client/doctor.rs
+++ b/crates/atuin/src/command/client/doctor.rs
@@ -255,8 +255,7 @@ impl SyncInfo {
.await
.ok()
.flatten()
- .filter(|t| t.starts_with("atapi_"))
- .is_some(),
+ .is_some_and(|t| t.starts_with("atapi_")),
None => false,
};
let has_cli_token = match &meta {
diff --git a/crates/atuin/src/command/client/dotfiles/alias.rs b/crates/atuin/src/command/client/dotfiles/alias.rs
index 983c67f1..61f8601d 100644
--- a/crates/atuin/src/command/client/dotfiles/alias.rs
+++ b/crates/atuin/src/command/client/dotfiles/alias.rs
@@ -95,10 +95,10 @@ impl Cmd {
// Apply sorting
match sort_by {
SortBy::Name => {
- aliases.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
+ aliases.sort_by_key(|a| a.name.to_lowercase());
}
SortBy::Value => {
- aliases.sort_by(|a, b| a.value.to_lowercase().cmp(&b.value.to_lowercase()));
+ aliases.sort_by_key(|a| a.value.to_lowercase());
}
}
diff --git a/crates/atuin/src/command/client/dotfiles/var.rs b/crates/atuin/src/command/client/dotfiles/var.rs
index a63231ec..94f75d57 100644
--- a/crates/atuin/src/command/client/dotfiles/var.rs
+++ b/crates/atuin/src/command/client/dotfiles/var.rs
@@ -111,10 +111,10 @@ impl Cmd {
// Apply sorting
match sort_by {
SortBy::Name => {
- vars.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
+ vars.sort_by_key(|a| a.name.to_lowercase());
}
SortBy::Value => {
- vars.sort_by(|a, b| a.value.to_lowercase().cmp(&b.value.to_lowercase()));
+ vars.sort_by_key(|a| a.value.to_lowercase());
}
}
diff --git a/crates/atuin/src/command/client/import.rs b/crates/atuin/src/command/client/import.rs
index 4df14ce8..88c9dfff 100644
--- a/crates/atuin/src/command/client/import.rs
+++ b/crates/atuin/src/command/client/import.rs
@@ -78,7 +78,7 @@ impl Cmd {
let shell = env::var("SHELL").unwrap_or_else(|_| String::from("NO_SHELL"));
if xonsh_histfile.to_lowercase().ends_with(".json") {
- println!("Detected Xonsh",);
+ println!("Detected Xonsh");
import::<Xonsh, DB>(db).await
} else if xonsh_histfile.to_lowercase().ends_with(".sqlite") {
println!("Detected Xonsh (SQLite backend)");
diff --git a/crates/atuin/src/command/client/search/inspector.rs b/crates/atuin/src/command/client/search/inspector.rs
index 151e1354..a6e2edf0 100644
--- a/crates/atuin/src/command/client/search/inspector.rs
+++ b/crates/atuin/src/command/client/search/inspector.rs
@@ -183,7 +183,7 @@ fn sort_duration_over_time(durations: &[(String, i64)]) -> Vec<(String, i64)> {
})
.collect();
- durations.sort_by(|a, b| a.0.cmp(&b.0));
+ durations.sort_by_key(|a| a.0);
durations
.iter()
diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs
index ee38ddaa..4464bf22 100644
--- a/crates/atuin/src/command/client/search/interactive.rs
+++ b/crates/atuin/src/command/client/search/interactive.rs
@@ -1208,7 +1208,7 @@ impl State {
let mode_width = usize::from(prefix_width) - pref.len() - 3;
// sanity check to ensure we don't exceed the layout limits
debug_assert!(mode_width >= mode.len(), "mode name '{mode}' is too long!");
- let input = format!("[{pref}{mode:^mode_width$}] {}", self.search.input.as_str(),);
+ let input = format!("[{pref}{mode:^mode_width$}] {}", self.search.input.as_str());
let input = Paragraph::new(input);
match style.compactness {
Compactness::Full => {
diff --git a/crates/atuin/src/command/client/wrapped.rs b/crates/atuin/src/command/client/wrapped.rs
index 20b79a2e..8d2b5e51 100644
--- a/crates/atuin/src/command/client/wrapped.rs
+++ b/crates/atuin/src/command/client/wrapped.rs
@@ -267,7 +267,7 @@ fn print_fun_facts(wrapped_stats: &WrappedStats, stats: &Stats, year: i32) {
// Time patterns
if let Some((hour, count)) = &wrapped_stats.busiest_hour {
- println!("\nšŸ•˜ Most Productive Hour: {bold}{hour}{reset} ({count} commands)",);
+ println!("\nšŸ•˜ Most Productive Hour: {bold}{hour}{reset} ({count} commands)");
// Night owl or early bird
let hour_num = hour