diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-13 20:45:15 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-13 20:45:15 +0200 |
| commit | abd0365c16ab2e65773f4c8d3b782c2e44128dc5 (patch) | |
| tree | 58011bca342adb6ff05aaf8a269ce12ee1b43f3d | |
| parent | build(flake): Expose nixos-module (diff) | |
| download | atuin-abd0365c16ab2e65773f4c8d3b782c2e44128dc5.zip | |
chore(treewide): Remove glob imports
20 files changed, 48 insertions, 152 deletions
diff --git a/crates/atuin-nucleo/matcher/src/chars/normalize.rs b/crates/atuin-nucleo/matcher/src/chars/normalize.rs index 7e3b3b17..cb3abe66 100644 --- a/crates/atuin-nucleo/matcher/src/chars/normalize.rs +++ b/crates/atuin-nucleo/matcher/src/chars/normalize.rs @@ -893,7 +893,7 @@ static SUPERSCRIPTS_AND_SUBSCRIPTS: [char; 48] = [ #[cfg(test)] mod tests { - use super::*; + use super::normalize; /// Helper function for test assertions. fn check_conversions(pairs: &[(char, char)]) { diff --git a/crates/atuin-nucleo/matcher/src/tests.rs b/crates/atuin-nucleo/matcher/src/tests.rs index a883c6ba..6cd48bc4 100644 --- a/crates/atuin-nucleo/matcher/src/tests.rs +++ b/crates/atuin-nucleo/matcher/src/tests.rs @@ -7,7 +7,7 @@ use crate::score::{ use crate::utf32_str::Utf32Str; use crate::{Config, Matcher}; -use Algorithm::*; +use Algorithm::{Exact, FuzzyGreedy, FuzzyOptimal, Postfix, Prefix, Substring}; #[derive(Debug)] enum Algorithm { diff --git a/crates/atuin-nucleo/src/boxcar.rs b/crates/atuin-nucleo/src/boxcar.rs index 726f4dff..e54afc05 100644 --- a/crates/atuin-nucleo/src/boxcar.rs +++ b/crates/atuin-nucleo/src/boxcar.rs @@ -655,7 +655,7 @@ impl Location { #[cfg(test)] mod tests { - use super::*; + use super::{Location, Vec, BUCKETS, MAX_ENTRIES}; #[test] fn location() { @@ -780,7 +780,7 @@ mod tests { fn extend_over_max_capacity() { let vec = Vec::<u32>::with_capacity(1, 1); let count = MAX_ENTRIES as usize + 2; - let iter = std::iter::repeat(0).take(count); + let iter = std::iter::repeat_n(0, count); assert!(std::panic::catch_unwind(|| vec.extend(iter, |_, _| {})).is_err()); } } diff --git a/crates/atuin-nucleo/src/worker.rs b/crates/atuin-nucleo/src/worker.rs index 83472e79..bebfa308 100644 --- a/crates/atuin-nucleo/src/worker.rs +++ b/crates/atuin-nucleo/src/worker.rs @@ -5,7 +5,10 @@ use std::sync::Arc; use atuin_nucleo_matcher::Config; use parking_lot::Mutex; -use rayon::{prelude::*, ThreadPool}; +use rayon::{ + prelude::{IntoParallelRefMutIterator, ParallelExtend, ParallelIterator}, + ThreadPool, +}; use crate::par_sort::par_quicksort; use crate::pattern::{self, MultiPattern}; diff --git a/crates/turtle/src/atuin_client/database.rs b/crates/turtle/src/atuin_client/database.rs index c3130c4c..a9eb2058 100644 --- a/crates/turtle/src/atuin_client/database.rs +++ b/crates/turtle/src/atuin_client/database.rs @@ -802,7 +802,9 @@ impl SqlBuilderExt for SqlBuilder { mod test { use crate::atuin_client::settings::test_local_timeout; - use super::*; + use super::{ + ClientSqlite, Context, FilterMode, History, OffsetDateTime, OptFilters, Result, SearchMode, + }; use std::time::{Duration, Instant}; async fn assert_search_eq( diff --git a/crates/turtle/src/atuin_client/meta.rs b/crates/turtle/src/atuin_client/meta.rs index c5c89512..079c9926 100644 --- a/crates/turtle/src/atuin_client/meta.rs +++ b/crates/turtle/src/atuin_client/meta.rs @@ -136,7 +136,7 @@ impl MetaStore { #[cfg(test)] mod tests { - use super::*; + use super::{MetaStore, OffsetDateTime}; async fn new_test_store() -> MetaStore { MetaStore::new("sqlite::memory:", 2.0).await.unwrap() diff --git a/crates/turtle/src/atuin_client/record/encryption.rs b/crates/turtle/src/atuin_client/record/encryption.rs index afac5b02..96ab463e 100644 --- a/crates/turtle/src/atuin_client/record/encryption.rs +++ b/crates/turtle/src/atuin_client/record/encryption.rs @@ -206,7 +206,9 @@ mod tests { utils::uuid_v7, }; - use super::*; + use super::{ + AdditionalData, DecryptedData, Encryption, HostId, Key, Local, PASETO_V4, RecordId, V4, + }; #[test] fn round_trip() { diff --git a/crates/turtle/src/atuin_common/utils.rs b/crates/turtle/src/atuin_common/utils.rs index 92b4e781..dbe9dfbc 100644 --- a/crates/turtle/src/atuin_common/utils.rs +++ b/crates/turtle/src/atuin_common/utils.rs @@ -146,8 +146,7 @@ impl<T: AsRef<str>> Escapable for T {} #[cfg(test)] mod tests { - - use super::*; + use super::{Cow, Escapable, Uuid, env, in_git_repo, uuid_v7}; use std::collections::HashSet; diff --git a/crates/turtle/src/atuin_daemon/search/mod.rs b/crates/turtle/src/atuin_daemon/search/mod.rs index 04beb459..02c79c9c 100644 --- a/crates/turtle/src/atuin_daemon/search/mod.rs +++ b/crates/turtle/src/atuin_daemon/search/mod.rs @@ -93,7 +93,9 @@ impl FrecencyData { let frequency_score = (f64::from(self.count).ln() * 20.0).min(100.0); // Apply multipliers and combine scores, then round to u32 - recency_score.mul_add(recency_mul, frequency_score * frequency_mul).round() as u32 + recency_score + .mul_add(recency_mul, frequency_score * frequency_mul) + .round() as u32 } } @@ -481,8 +483,7 @@ impl Default for SearchIndex { #[cfg(test)] mod tests { - use super::*; - use time::macros::datetime; + use super::FrecencyData; #[test] fn frecency_data_compute() { @@ -553,126 +554,4 @@ mod tests { assert!(boost_recency > default_score); assert!(boost_recency < double_recency); } - - #[test] - fn command_data_add_invocation() { - let interner = ThreadedRodeo::new(); - - let (dir1, dir2) = if cfg!(windows) { - ("C:\\Users\\User\\project", "C:\\Users\\User\\other") - } else { - ("/home/user/project", "/home/user/other") - }; - - let history1 = make_history("git status", dir1, datetime!(2024-01-01 10:00 UTC)); - let history2 = make_history("git status", dir2, datetime!(2024-01-01 12:00 UTC)); - - let mut data = CommandData::new(&history1, &interner).unwrap(); - assert_eq!(data.global_frecency.count, 1); - let id1 = data.most_recent_id(); - - data.add_invocation(&history2, &interner); - assert_eq!(data.global_frecency.count, 2); - - // Most recent ID should update to history2 (newer timestamp) - let id2 = data.most_recent_id(); - assert_ne!(id1, id2); - } - - #[test] - fn command_data_filters() { - let interner = ThreadedRodeo::new(); - - let (dir1, dir2) = if cfg!(windows) { - ("C:\\Users\\User\\project", "C:\\Users\\User\\other") - } else { - ("/home/user/project", "/home/user/other") - }; - - let h1 = make_history("git status", dir1, datetime!(2024-01-01 10:00 UTC)); - let h2 = make_history("git status", dir2, datetime!(2024-01-01 12:00 UTC)); - - let mut data = CommandData::new(&h1, &interner).unwrap(); - data.add_invocation(&h2, &interner); - - let (check1, check2, check3) = if cfg!(windows) { - ( - with_trailing_slash("C:\\Users\\User\\project"), - with_trailing_slash("C:\\Users\\User\\other"), - with_trailing_slash("C:\\Users\\User\\missing"), - ) - } else { - ( - with_trailing_slash("/home/user/project"), - with_trailing_slash("/home/user/other"), - with_trailing_slash("/home/user/missing"), - ) - }; - - assert!(data.has_invocation_in_dir(&check1, &interner)); - assert!(data.has_invocation_in_dir(&check2, &interner)); - assert!(!data.has_invocation_in_dir(&check3, &interner)); - - let (check1, check2, check3) = if cfg!(windows) { - ( - with_trailing_slash("C:\\Users\\User"), - with_trailing_slash("C:\\Users"), - with_trailing_slash("C:\\Users\\User\\var"), - ) - } else { - ( - with_trailing_slash("/home/user"), - with_trailing_slash("/home"), - with_trailing_slash("/var"), - ) - }; - - assert!(data.has_invocation_in_workspace(&check1, &interner)); - assert!(data.has_invocation_in_workspace(&check2, &interner)); - assert!(!data.has_invocation_in_workspace(&check3, &interner)); - } - - #[tokio::test] - async fn search_index_add_and_search() { - let index = SearchIndex::new(); - - let h1 = make_history( - "git status", - "/home/user/project", - datetime!(2024-01-01 10:00 UTC), - ); - let h2 = make_history( - "git commit -m 'test'", - "/home/user/project", - datetime!(2024-01-01 10:05 UTC), - ); - let h3 = make_history( - "ls -la", - "/home/user/other", - datetime!(2024-01-01 10:10 UTC), - ); - - index.add_history(&h1); - index.add_history(&h2); - index.add_history(&h3); - - assert_eq!(index.command_count(), 3); - - // Search for "git" - should match 2 commands - let results = index - .search("git", IndexFilterMode::Global, &QueryContext::default(), 10) - .await; - assert_eq!(results.len(), 2); - - // Search with directory filter - let results = index - .search( - "", - IndexFilterMode::Directory(with_trailing_slash("/home/user/project")), - &QueryContext::default(), - 10, - ) - .await; - assert_eq!(results.len(), 2); // git status and git commit - } } diff --git a/crates/turtle/src/atuin_pty_proxy/capture.rs b/crates/turtle/src/atuin_pty_proxy/capture.rs index efba3c0b..55bc1788 100644 --- a/crates/turtle/src/atuin_pty_proxy/capture.rs +++ b/crates/turtle/src/atuin_pty_proxy/capture.rs @@ -199,7 +199,9 @@ fn estimated_rows(bytes: &[u8], cols: u16) -> u16 { #[cfg(test)] mod tests { - use super::*; + use crate::atuin_pty_proxy::capture::render_plain_text; + + use super::{Arc, AtomicU16, CommandCapture, CommandCaptureTracker, MAX_OUTPUT_CAPTURE_BYTES}; fn tracker(cols: u16) -> CommandCaptureTracker { CommandCaptureTracker::new(Arc::new(AtomicU16::new(cols))) diff --git a/crates/turtle/src/atuin_pty_proxy/osc133.rs b/crates/turtle/src/atuin_pty_proxy/osc133.rs index b0cf0f0a..f2a796f1 100644 --- a/crates/turtle/src/atuin_pty_proxy/osc133.rs +++ b/crates/turtle/src/atuin_pty_proxy/osc133.rs @@ -362,7 +362,7 @@ fn parse_param(param: &[u8]) -> Param { #[cfg(test)] mod tests { - use super::*; + use super::{BEL, Event, LocatedEvent, Param, Params, Parser, Zone}; /// Collect all events from a single `push` call. fn parse_events(data: &[u8]) -> Vec<Event> { diff --git a/crates/turtle/src/command/client.rs b/crates/turtle/src/command/client.rs index 2ec5abe7..6c0e70e8 100644 --- a/crates/turtle/src/command/client.rs +++ b/crates/turtle/src/command/client.rs @@ -3,13 +3,16 @@ use std::path::{Path, PathBuf}; use clap::Subcommand; use eyre::{Result, WrapErr}; +use tracing_subscriber::util::SubscriberInitExt; -use crate::atuin_client::{ - database::ClientSqlite, record::sqlite_store::SqliteStore, settings::Settings, -}; use tracing_appender::rolling::{RollingFileAppender, Rotation}; use tracing_subscriber::{ - Layer, filter::EnvFilter, filter::LevelFilter, fmt, fmt::format::FmtSpan, prelude::*, + Layer, filter::EnvFilter, filter::LevelFilter, fmt, fmt::format::FmtSpan, + prelude::__tracing_subscriber_SubscriberExt, +}; + +use crate::atuin_client::{ + database::ClientSqlite, record::sqlite_store::SqliteStore, settings::Settings, }; fn cleanup_old_logs(log_dir: &Path, prefix: &str, retention_days: u64) { diff --git a/crates/turtle/src/command/client/daemon.rs b/crates/turtle/src/command/client/daemon.rs index 30b478ec..39aa1b1e 100644 --- a/crates/turtle/src/command/client/daemon.rs +++ b/crates/turtle/src/command/client/daemon.rs @@ -548,7 +548,9 @@ fn kill_process(pid: u32) { #[cfg(test)] mod tests { - use super::*; + use super::{ + DAEMON_PROTOCOL_VERSION, DAEMON_VERSION, daemon_matches_expected, daemon_mismatch_message, + }; #[test] fn test_version_matches() { diff --git a/crates/turtle/src/command/client/history.rs b/crates/turtle/src/command/client/history.rs index fde73449..9f383a08 100644 --- a/crates/turtle/src/command/client/history.rs +++ b/crates/turtle/src/command/client/history.rs @@ -1043,7 +1043,9 @@ impl Cmd { mod tests { use time::macros::datetime; - use super::*; + use super::{ + History, Settings, TailEvent, TailKind, Timezone, normalize_command_for_storage, parse_fmt, + }; #[test] fn normalize_command_strips_trailing_spaces_and_tabs() { diff --git a/crates/turtle/src/command/client/search/cursor.rs b/crates/turtle/src/command/client/search/cursor.rs index a69f1359..e13e52b3 100644 --- a/crates/turtle/src/command/client/search/cursor.rs +++ b/crates/turtle/src/command/client/search/cursor.rs @@ -279,15 +279,14 @@ impl Cursor { #[cfg(test)] mod cursor_tests { - use super::Cursor; - use super::*; + use super::{Cursor, WordJumpMode, WordJumper}; - static EMACS_WORD_JUMPER: WordJumper = WordJumper { + static EMACS_WORD_JUMPER: WordJumper<'_> = WordJumper { word_chars: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", word_jump_mode: WordJumpMode::Emacs, }; - static SUBL_WORD_JUMPER: WordJumper = WordJumper { + static SUBL_WORD_JUMPER: WordJumper<'_> = WordJumper { word_chars: "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?", word_jump_mode: WordJumpMode::Subl, }; diff --git a/crates/turtle/src/command/client/search/inspector.rs b/crates/turtle/src/command/client/search/inspector.rs index 6c2c59fe..186dcd3a 100644 --- a/crates/turtle/src/command/client/search/inspector.rs +++ b/crates/turtle/src/command/client/search/inspector.rs @@ -334,7 +334,10 @@ pub(crate) fn draw_full( mod tests { use super::draw_ultracompact; use crate::atuin_client::history::{History, HistoryId, HistoryStats}; - use ratatui::{backend::TestBackend, prelude::*}; + use ratatui::{ + backend::TestBackend, + prelude::{Line, Rect, Terminal}, + }; use time::OffsetDateTime; fn mock_history_stats() -> (History, HistoryStats) { diff --git a/crates/turtle/src/command/client/search/keybindings/actions.rs b/crates/turtle/src/command/client/search/keybindings/actions.rs index e9b654c5..2842d618 100644 --- a/crates/turtle/src/command/client/search/keybindings/actions.rs +++ b/crates/turtle/src/command/client/search/keybindings/actions.rs @@ -242,7 +242,7 @@ impl<'de> Deserialize<'de> for Action { #[cfg(test)] mod tests { - use super::*; + use super::Action; #[test] fn parse_basic_actions() { diff --git a/crates/turtle/src/command/client/search/keybindings/conditions.rs b/crates/turtle/src/command/client/search/keybindings/conditions.rs index e52e4864..fd993f2b 100644 --- a/crates/turtle/src/command/client/search/keybindings/conditions.rs +++ b/crates/turtle/src/command/client/search/keybindings/conditions.rs @@ -373,7 +373,7 @@ impl<'de> Deserialize<'de> for ConditionExpr { #[cfg(test)] mod tests { - use super::*; + use super::{ConditionAtom, ConditionExpr, EvalContext}; fn ctx( cursor: usize, diff --git a/crates/turtle/src/command/client/search/keybindings/key.rs b/crates/turtle/src/command/client/search/keybindings/key.rs index 841656d2..5e772238 100644 --- a/crates/turtle/src/command/client/search/keybindings/key.rs +++ b/crates/turtle/src/command/client/search/keybindings/key.rs @@ -315,7 +315,7 @@ impl<'de> Deserialize<'de> for KeyInput { #[cfg(test)] mod tests { - use super::*; + use super::{KeyCodeValue, KeyInput, SingleKey}; use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; #[test] diff --git a/crates/turtle/src/command/client/search/keybindings/keymap.rs b/crates/turtle/src/command/client/search/keybindings/keymap.rs index 00678b20..067d9403 100644 --- a/crates/turtle/src/command/client/search/keybindings/keymap.rs +++ b/crates/turtle/src/command/client/search/keybindings/keymap.rs @@ -117,7 +117,7 @@ impl Default for Keymap { #[cfg(test)] mod tests { use super::super::conditions::ConditionAtom; - use super::*; + use super::{Action, EvalContext, KeyInput, KeyRule, Keymap, SingleKey}; fn make_ctx(cursor: usize, width: usize, selected: usize, len: usize) -> EvalContext { EvalContext { |
