diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-10 22:28:10 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-10 22:28:10 +0200 |
| commit | b4011176cc4b68aed77a6946610a3dcf3b938e95 (patch) | |
| tree | 65120528263f2330b06829fecf2c4a76052069c7 | |
| parent | chore: Remove more useless code (diff) | |
| download | atuin-b4011176cc4b68aed77a6946610a3dcf3b938e95.zip | |
chore: Turn all `allow`s into into `expect`s
38 files changed, 81 insertions, 81 deletions
diff --git a/crates/atuin-client/src/database.rs b/crates/atuin-client/src/database.rs index 75ef51c3..946c1eb0 100644 --- a/crates/atuin-client/src/database.rs +++ b/crates/atuin-client/src/database.rs @@ -159,7 +159,7 @@ pub trait Database: Send + Sync + 'static { // Yes I know, it's a lot. // Could maybe break it down to a searchparams struct or smth but that feels a little... pointless. // Been debating maybe a DSL for search? eg "before:time limit:1 the query" - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] async fn search( &self, search_mode: SearchMode, diff --git a/crates/atuin-client/src/history.rs b/crates/atuin-client/src/history.rs index 16f7d85a..aa0d84d5 100644 --- a/crates/atuin-client/src/history.rs +++ b/crates/atuin-client/src/history.rs @@ -139,7 +139,7 @@ impl History { }) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn new( timestamp: OffsetDateTime, command: String, diff --git a/crates/atuin-client/src/import/resh.rs b/crates/atuin-client/src/import/resh.rs index de02d041..df15f5b4 100644 --- a/crates/atuin-client/src/import/resh.rs +++ b/crates/atuin-client/src/import/resh.rs @@ -104,15 +104,15 @@ impl Importer for Resh { Err(_) => continue, // skip invalid json :shrug: }; - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let timestamp = { let secs = entry.realtime_before.floor() as i64; let nanosecs = (entry.realtime_before.fract() * 1_000_000_000_f64).round() as i64; OffsetDateTime::from_unix_timestamp(secs)? + time::Duration::nanoseconds(nanosecs) }; - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let duration = { let secs = entry.realtime_after.floor() as i64; let nanosecs = (entry.realtime_after.fract() * 1_000_000_000_f64).round() as i64; diff --git a/crates/atuin-client/src/import/zsh_histdb.rs b/crates/atuin-client/src/import/zsh_histdb.rs index cac85566..bf44c3ad 100644 --- a/crates/atuin-client/src/import/zsh_histdb.rs +++ b/crates/atuin-client/src/import/zsh_histdb.rs @@ -178,7 +178,7 @@ mod test { use sqlx::sqlite::SqlitePoolOptions; use std::env; #[tokio::test(flavor = "multi_thread")] - #[allow(unsafe_code)] + #[expect(unsafe_code)] async fn test_env_vars() { let test_env_db = "nonstd-zsh-history.db"; let key = "HISTDB_FILE"; diff --git a/crates/atuin-client/src/record/encryption.rs b/crates/atuin-client/src/record/encryption.rs index 176d75f5..1e94d967 100644 --- a/crates/atuin-client/src/record/encryption.rs +++ b/crates/atuin-client/src/record/encryption.rs @@ -10,7 +10,7 @@ use rusty_paseto::core::{ use serde::{Deserialize, Serialize}; /// Use PASETO V4 Local encryption using the additional data as an implicit assertion. -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub struct PASETO_V4; /* diff --git a/crates/atuin-common/src/utils.rs b/crates/atuin-common/src/utils.rs index 1a6fb8b7..d7382fb2 100644 --- a/crates/atuin-common/src/utils.rs +++ b/crates/atuin-common/src/utils.rs @@ -208,7 +208,7 @@ pub fn unquote(s: &str) -> Result<String> { impl<T: AsRef<str>> Escapable for T {} -#[allow(unsafe_code)] +#[expect(unsafe_code)] #[cfg(test)] mod tests { use pretty_assertions::assert_ne; diff --git a/crates/atuin-history/src/sort.rs b/crates/atuin-history/src/sort.rs index 4465a142..022865a2 100644 --- a/crates/atuin-history/src/sort.rs +++ b/crates/atuin-history/src/sort.rs @@ -31,7 +31,7 @@ pub fn sort(query: &str, input: Vec<History>) -> Vec<History> { // prefer newer history, but not hugely so as to offset the other scoring // the numbers will get super small over time, but I don't want time to overpower other // scoring - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] let time_score = 1.0 + (1.0 / diff as f64); let score = score * time_score; diff --git a/crates/atuin-nucleo/matcher/src/chars.rs b/crates/atuin-nucleo/matcher/src/chars.rs index d13a2466..045d9b2d 100644 --- a/crates/atuin-nucleo/matcher/src/chars.rs +++ b/crates/atuin-nucleo/matcher/src/chars.rs @@ -7,7 +7,7 @@ use crate::chars::case_fold::CASE_FOLDING_SIMPLE; use crate::Config; //autogenerated by generate-ucd -#[allow(warnings)] +#[expect(warnings)] #[rustfmt::skip] #[cfg(feature = "unicode-casefold")] mod case_fold; diff --git a/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs b/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs index 1bcebe2c..c3aad8c3 100644 --- a/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs +++ b/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs @@ -179,7 +179,7 @@ impl<H: Char> MatcherDataView<'_, H> { true } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn score_row<const FIRST_ROW: bool, const INDICES: bool, N: Char>( current_row: &mut [ScoreCell], matrix_cells: &mut [MatrixCell], diff --git a/crates/atuin-nucleo/matcher/src/lib.rs b/crates/atuin-nucleo/matcher/src/lib.rs index 9ae4b665..e40c5be7 100644 --- a/crates/atuin-nucleo/matcher/src/lib.rs +++ b/crates/atuin-nucleo/matcher/src/lib.rs @@ -152,7 +152,7 @@ use crate::matrix::MatrixSlab; /// that the matcher **will panic**. The caller must decide whether it wants to /// filter out long haystacks or truncate them. pub struct Matcher { - #[allow(missing_docs)] + #[expect(missing_docs)] pub config: Config, slab: MatrixSlab, } diff --git a/crates/atuin-nucleo/matcher/src/matrix.rs b/crates/atuin-nucleo/matcher/src/matrix.rs index a91ed95f..5c68f2fd 100644 --- a/crates/atuin-nucleo/matcher/src/matrix.rs +++ b/crates/atuin-nucleo/matcher/src/matrix.rs @@ -60,7 +60,7 @@ impl<C: Char> MatrixLayout<C> { /// # Safety /// /// `ptr` must point at an allocated with MARTIX_ALLOC_LAYOUT - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] unsafe fn fieds_from_ptr( &self, ptr: NonNull<u8>, @@ -128,7 +128,7 @@ impl MatrixCell { } // we only use this to construct the layout for the slab allocation -#[allow(unused)] +#[expect(unused)] struct MatcherData { haystack: [char; MAX_HAYSTACK_LEN], bonus: [u8; MAX_HAYSTACK_LEN], diff --git a/crates/atuin-nucleo/src/par_sort.rs b/crates/atuin-nucleo/src/par_sort.rs index 92f716cc..b7ca3f9e 100644 --- a/crates/atuin-nucleo/src/par_sort.rs +++ b/crates/atuin-nucleo/src/par_sort.rs @@ -703,7 +703,7 @@ where let len = v.len(); // Three indices near which we are going to choose a pivot. - #[allow(clippy::identity_op)] + #[expect(clippy::identity_op)] let mut a = len / 4 * 1; let mut b = len / 4 * 2; let mut c = len / 4 * 3; diff --git a/crates/atuin-nucleo/src/worker.rs b/crates/atuin-nucleo/src/worker.rs index 45e27cee..83472e79 100644 --- a/crates/atuin-nucleo/src/worker.rs +++ b/crates/atuin-nucleo/src/worker.rs @@ -15,7 +15,7 @@ struct Matchers(Box<[UnsafeCell<atuin_nucleo_matcher::Matcher>]>); impl Matchers { // this is not a true mut from ref, we use a cell here - #[allow(clippy::mut_from_ref)] + #[expect(clippy::mut_from_ref)] unsafe fn get(&self) -> &mut atuin_nucleo_matcher::Matcher { &mut *self.0[rayon::current_thread_index().unwrap()].get() } diff --git a/crates/atuin-pty-proxy/src/lib.rs b/crates/atuin-pty-proxy/src/lib.rs index 65b03df3..d1571079 100644 --- a/crates/atuin-pty-proxy/src/lib.rs +++ b/crates/atuin-pty-proxy/src/lib.rs @@ -17,7 +17,7 @@ pub use capture::{CommandCapture, CommandCaptureSink}; pub use pty_proxy::PtyProxy; #[cfg(not(unix))] -#[allow(dead_code)] +#[expect(dead_code)] mod unsupported { use clap::{Args, Subcommand}; diff --git a/crates/atuin-pty-proxy/src/osc133.rs b/crates/atuin-pty-proxy/src/osc133.rs index 51fda848..5b70f0aa 100644 --- a/crates/atuin-pty-proxy/src/osc133.rs +++ b/crates/atuin-pty-proxy/src/osc133.rs @@ -98,7 +98,7 @@ pub struct LocatedEvent { /// The current semantic zone as determined by the most recent OSC 133 marker. #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] -#[allow(dead_code)] +#[expect(dead_code)] pub enum Zone { /// No marker seen yet, or after a `D` marker (between commands). #[default] @@ -178,7 +178,7 @@ impl Parser { /// The current semantic zone based on markers seen so far. #[inline] - #[allow(dead_code)] + #[expect(dead_code)] pub fn zone(&self) -> Zone { self.zone } diff --git a/crates/atuin-pty-proxy/src/pty_proxy.rs b/crates/atuin-pty-proxy/src/pty_proxy.rs index 030ef9b5..19ccd274 100644 --- a/crates/atuin-pty-proxy/src/pty_proxy.rs +++ b/crates/atuin-pty-proxy/src/pty_proxy.rs @@ -27,7 +27,7 @@ pub struct Init { #[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)] #[value(rename_all = "lower")] -#[allow(clippy::enum_variant_names, clippy::doc_markdown)] +#[expect(clippy::enum_variant_names, clippy::doc_markdown)] enum Shell { /// Zsh setup Zsh, diff --git a/crates/atuin/src/command/client.rs b/crates/atuin/src/command/client.rs index a1ebff29..6c1bac29 100644 --- a/crates/atuin/src/command/client.rs +++ b/crates/atuin/src/command/client.rs @@ -150,7 +150,7 @@ impl Cmd { res } - #[allow(clippy::too_many_lines, clippy::future_not_send)] + #[expect(clippy::too_many_lines, clippy::future_not_send)] async fn run_inner( self, mut settings: Settings, diff --git a/crates/atuin/src/command/client/daemon.rs b/crates/atuin/src/command/client/daemon.rs index 483829e9..c3dcf9d0 100644 --- a/crates/atuin/src/command/client/daemon.rs +++ b/crates/atuin/src/command/client/daemon.rs @@ -331,7 +331,7 @@ async fn wait_until_ready(settings: &Settings, timeout: Duration) -> Result<Hist } } -#[allow(clippy::unnecessary_wraps)] +#[expect(clippy::unnecessary_wraps)] fn ensure_autostart_supported(settings: &Settings) -> Result<()> { #[cfg(unix)] if settings.daemon.systemd_socket { diff --git a/crates/atuin/src/command/client/doctor.rs b/crates/atuin/src/command/client/doctor.rs index f6470226..6c9dcca6 100644 --- a/crates/atuin/src/command/client/doctor.rs +++ b/crates/atuin/src/command/client/doctor.rs @@ -95,13 +95,13 @@ impl ShellInfo { Bash, // Note: these are currently unused - #[allow(dead_code)] + #[expect(dead_code)] Zsh, - #[allow(dead_code)] + #[expect(dead_code)] Fish, - #[allow(dead_code)] + #[expect(dead_code)] Nushell, - #[allow(dead_code)] + #[expect(dead_code)] Xonsh, } diff --git a/crates/atuin/src/command/client/history.rs b/crates/atuin/src/command/client/history.rs index 98381e77..ccbf66cf 100644 --- a/crates/atuin/src/command/client/history.rs +++ b/crates/atuin/src/command/client/history.rs @@ -181,7 +181,7 @@ impl ListMode { } } -#[allow(clippy::cast_sign_loss)] +#[expect(clippy::cast_sign_loss)] pub fn print_list( h: &[History], list_mode: ListMode, @@ -305,7 +305,7 @@ static TIME_FMT: &[time::format_description::FormatItem<'static>] = /// defines how to format the history impl FormatKey for FmtHistory<'_> { - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] fn fmt(&self, key: &str, f: &mut fmt::Formatter<'_>) -> Result<(), FormatKeyError> { match key { "command" => match self.cmd_format { @@ -482,7 +482,7 @@ async fn handle_daemon_start( Ok(Some(resp)) } -#[allow(unused_variables)] +#[expect(unused_variables)] async fn handle_end( db: &impl Database, store: SqliteStore, @@ -928,9 +928,9 @@ impl Cmd { Ok(()) } - #[allow(clippy::too_many_lines, clippy::cast_possible_truncation)] - #[allow(clippy::too_many_arguments)] - #[allow(clippy::fn_params_excessive_bools)] + #[expect(clippy::too_many_lines, clippy::cast_possible_truncation)] + #[expect(clippy::too_many_arguments)] + #[expect(clippy::fn_params_excessive_bools)] async fn handle_list( db: &impl Database, settings: &Settings, @@ -1092,7 +1092,7 @@ impl Cmd { Ok(()) } - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub async fn run(self, settings: &Settings) -> Result<()> { match self { Self::Start { diff --git a/crates/atuin/src/command/client/import.rs b/crates/atuin/src/command/client/import.rs index 88c9dfff..21ac76b4 100644 --- a/crates/atuin/src/command/client/import.rs +++ b/crates/atuin/src/command/client/import.rs @@ -48,7 +48,7 @@ pub enum Cmd { const BATCH_SIZE: usize = 100; impl Cmd { - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] pub async fn run<DB: Database>(&self, db: &DB) -> Result<()> { println!(" Atuin "); println!("======================"); diff --git a/crates/atuin/src/command/client/init.rs b/crates/atuin/src/command/client/init.rs index e0f284a7..39cd1247 100644 --- a/crates/atuin/src/command/client/init.rs +++ b/crates/atuin/src/command/client/init.rs @@ -26,7 +26,7 @@ pub struct Cmd { #[derive(Clone, Copy, ValueEnum, Debug)] #[value(rename_all = "lower")] -#[allow(clippy::enum_variant_names, clippy::doc_markdown)] +#[expect(clippy::enum_variant_names, clippy::doc_markdown)] pub enum Shell { /// Zsh setup Zsh, diff --git a/crates/atuin/src/command/client/search.rs b/crates/atuin/src/command/client/search.rs index 8eaf1b0c..a9dc9a68 100644 --- a/crates/atuin/src/command/client/search.rs +++ b/crates/atuin/src/command/client/search.rs @@ -27,7 +27,7 @@ pub mod keybindings; pub use duration::format_duration_into; -#[allow(clippy::struct_excessive_bools, clippy::struct_field_names)] +#[expect(clippy::struct_excessive_bools, clippy::struct_field_names)] #[derive(Parser, Debug)] pub struct Cmd { /// Filter search result by directory @@ -118,7 +118,7 @@ pub struct Cmd { #[arg(allow_hyphen_values = true)] // Clippy warns about `Option<Option<T>>`, but we suppress it because we need // this distinction for proper argument handling. - #[allow(clippy::option_option)] + #[expect(clippy::option_option)] timezone: Option<Option<Timezone>>, /// Available variables: {command}, {directory}, {duration}, {user}, {host}, {time}, {exit} and @@ -154,7 +154,7 @@ impl Cmd { // clippy: please write this instead // clippy: now it has too many lines // me: I'll do it later OKAY - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub async fn run( self, db: impl Database, @@ -305,7 +305,7 @@ impl Cmd { // This is supposed to more-or-less mirror the command line version, so ofc // it is going to have a lot of args -#[allow(clippy::too_many_arguments, clippy::cast_possible_truncation)] +#[expect(clippy::too_many_arguments, clippy::cast_possible_truncation)] async fn run_non_interactive( settings: &Settings, filter_options: OptFilters, diff --git a/crates/atuin/src/command/client/search/duration.rs b/crates/atuin/src/command/client/search/duration.rs index dfa9426b..54856c87 100644 --- a/crates/atuin/src/command/client/search/duration.rs +++ b/crates/atuin/src/command/client/search/duration.rs @@ -1,7 +1,7 @@ use core::fmt; use std::{ops::ControlFlow, time::Duration}; -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub fn format_duration_into(dur: Duration, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn item(unit: &'static str, value: u64) -> ControlFlow<(&'static str, u64)> { if value > 0 { @@ -53,7 +53,7 @@ pub fn format_duration_into(dur: Duration, f: &mut fmt::Formatter<'_>) -> fmt::R } } -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub fn format_duration(f: Duration) -> String { struct F(Duration); impl fmt::Display for F { diff --git a/crates/atuin/src/command/client/search/engines.rs b/crates/atuin/src/command/client/search/engines.rs index 27c1c1b8..886f0171 100644 --- a/crates/atuin/src/command/client/search/engines.rs +++ b/crates/atuin/src/command/client/search/engines.rs @@ -13,7 +13,7 @@ pub mod daemon; pub mod db; pub mod skim; -#[allow(unused)] // settings is only used if daemon feature is enabled +#[expect(unused)] // settings is only used if daemon feature is enabled pub fn engine(search_mode: SearchMode, settings: &Settings) -> Box<dyn SearchEngine> { match search_mode { SearchMode::Skim => Box::new(skim::Search::new()) as Box<_>, diff --git a/crates/atuin/src/command/client/search/engines/skim.rs b/crates/atuin/src/command/client/search/engines/skim.rs index 1005b667..fe05fd09 100644 --- a/crates/atuin/src/command/client/search/engines/skim.rs +++ b/crates/atuin/src/command/client/search/engines/skim.rs @@ -60,7 +60,7 @@ async fn load_all_history(db: &dyn Database) -> Vec<(History, i32)> { db.all_with_count().await.unwrap() } -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] #[instrument(skip_all, level = Level::TRACE, name = "fuzzy_match", fields(history_count = all_history.len()))] async fn fuzzy_search( engine: &SkimMatcherV2, @@ -143,7 +143,7 @@ async fn fuzzy_search( FilterMode::Workspace if history.cwd.split(':').contains(&git_root) => {} _ => continue, } - #[allow(clippy::cast_lossless, clippy::cast_precision_loss)] + #[expect(clippy::cast_lossless, clippy::cast_precision_loss)] if let Some((score, indices)) = engine.fuzzy_indices(&history.command, query) { let begin = indices.first().copied().unwrap_or_default(); diff --git a/crates/atuin/src/command/client/search/history_list.rs b/crates/atuin/src/command/client/search/history_list.rs index 23c23548..7af324b4 100644 --- a/crates/atuin/src/command/client/search/history_list.rs +++ b/crates/atuin/src/command/client/search/history_list.rs @@ -117,7 +117,7 @@ impl StatefulWidget for HistoryList<'_> { } impl<'a> HistoryList<'a> { - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub fn new( history: &'a [History], inverted: bool, diff --git a/crates/atuin/src/command/client/search/inspector.rs b/crates/atuin/src/command/client/search/inspector.rs index a6e2edf0..e2cdabe5 100644 --- a/crates/atuin/src/command/client/search/inspector.rs +++ b/crates/atuin/src/command/client/search/inspector.rs @@ -20,7 +20,7 @@ use super::duration::format_duration; use super::super::theme::{Meaning, Theme}; use super::interactive::{Compactness, to_compactness}; -#[allow(clippy::cast_sign_loss)] +#[expect(clippy::cast_sign_loss)] fn u64_or_zero(num: i64) -> u64 { if num < 0 { 0 } else { num as u64 } } diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs index 8efe1f42..4efba803 100644 --- a/crates/atuin/src/command/client/search/interactive.rs +++ b/crates/atuin/src/command/client/search/interactive.rs @@ -111,8 +111,8 @@ pub fn to_compactness(f: &Frame, settings: &Settings) -> Compactness { } } -#[allow(clippy::struct_field_names)] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_field_names)] +#[expect(clippy::struct_excessive_bools)] pub struct State { history_count: i64, results_state: ListState, @@ -323,7 +323,7 @@ impl State { }; // The if-let/else-if chain here is clearer than map_or_else with nested closures. - #[allow(clippy::option_if_let_else)] + #[expect(clippy::option_if_let_else)] let (action, new_pending) = if prefix_action.is_some() { (prefix_action, None) } else { @@ -409,7 +409,7 @@ impl State { /// Invert handling: scroll actions (`SelectNext`, `ScrollPageDown`, etc.) account /// for `settings.invert` so that keybindings are always in "visual" terms — /// users never need to think about invert in their keybinding config. - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] pub(crate) fn execute_action( &mut self, action: &super::keybindings::Action, @@ -726,8 +726,8 @@ impl State { } } - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::bool_to_int_with_if)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::bool_to_int_with_if)] fn calc_preview_height( settings: &Settings, results: &[History], @@ -800,9 +800,9 @@ impl State { } } - #[allow(clippy::bool_to_int_with_if)] - #[allow(clippy::too_many_lines)] - #[allow(clippy::too_many_arguments)] + #[expect(clippy::bool_to_int_with_if)] + #[expect(clippy::too_many_lines)] + #[expect(clippy::too_many_arguments)] fn draw( &mut self, f: &mut Frame, @@ -820,9 +820,9 @@ impl State { self.draw_inner(f, area, results, stats, inspecting, settings, theme); } - #[allow(clippy::too_many_arguments)] - #[allow(clippy::too_many_lines)] - #[allow(clippy::bool_to_int_with_if)] + #[expect(clippy::too_many_arguments)] + #[expect(clippy::too_many_lines)] + #[expect(clippy::bool_to_int_with_if)] fn draw_inner( &mut self, f: &mut Frame, @@ -1031,7 +1031,7 @@ impl State { preview_chunk.width.into(), theme, ); - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let prefix_width = settings .ui .columns @@ -1040,7 +1040,7 @@ impl State { .map(|col| col.width + 1) .sum::<u16>() + " > ".len() as u16; - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] let min_prefix_width = "[ SRCH: FULLTXT ] ".len() as u16; self.draw_preview( f, @@ -1054,7 +1054,7 @@ impl State { } } - #[allow(clippy::cast_possible_truncation, clippy::too_many_arguments)] + #[expect(clippy::cast_possible_truncation, clippy::too_many_arguments)] fn draw_preview( &self, f: &mut Frame, @@ -1094,7 +1094,7 @@ impl State { title.alignment(Alignment::Left) } - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] fn build_help(&self, settings: &Settings, theme: &Theme) -> Paragraph<'_> { match self.tab_index { // search @@ -1142,7 +1142,7 @@ impl State { .alignment(Alignment::Right) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn build_results_list<'a>( style: StyleState, results: &'a [History], @@ -1371,9 +1371,9 @@ impl Drop for TerminalWriter { /// Screen state captured from atuin pty-proxy's screen server. #[cfg(unix)] struct SavedScreen { - #[allow(dead_code)] + #[expect(dead_code)] rows: u16, - #[allow(dead_code)] + #[expect(dead_code)] cols: u16, cursor_row: u16, cursor_col: u16, @@ -1596,7 +1596,7 @@ fn compute_popup_placement( // for now, it works. But it'd be great if it were more easily readable, and // modular. I'd like to add some more stats and stuff at some point -#[allow( +#[expect( clippy::cast_possible_truncation, clippy::too_many_lines, clippy::cognitive_complexity @@ -2066,7 +2066,7 @@ mod tests { use super::{Compactness, InspectingState, KeymapSet, State}; #[test] - #[allow(clippy::too_many_lines)] + #[expect(clippy::too_many_lines)] fn calc_preview_height_test() { let settings_preview_auto = Settings { preview: Preview { diff --git a/crates/atuin/src/command/client/search/keybindings/conditions.rs b/crates/atuin/src/command/client/search/keybindings/conditions.rs index d460d7d4..055ae905 100644 --- a/crates/atuin/src/command/client/search/keybindings/conditions.rs +++ b/crates/atuin/src/command/client/search/keybindings/conditions.rs @@ -140,7 +140,7 @@ impl From<ConditionAtom> for ConditionExpr { } } -#[allow(dead_code)] +#[expect(dead_code)] impl ConditionExpr { /// Negate this expression: `!self`. pub fn not(self) -> Self { diff --git a/crates/atuin/src/command/client/search/keybindings/defaults.rs b/crates/atuin/src/command/client/search/keybindings/defaults.rs index e9b3972c..a76cd4a9 100644 --- a/crates/atuin/src/command/client/search/keybindings/defaults.rs +++ b/crates/atuin/src/command/client/search/keybindings/defaults.rs @@ -100,7 +100,7 @@ fn accept_action(settings: &Settings) -> Action { /// - `keys.accept_with_backspace` — backspace at start of line accepts /// - `ctrl_n_shortcuts` — whether alt or ctrl is used for numeric shortcuts // Keymap builder that enumerates every default binding; not worth splitting. -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn default_emacs_keymap(settings: &Settings) -> Keymap { let mut km = Keymap::new(); add_common_bindings(&mut km); diff --git a/crates/atuin/src/command/client/search/keybindings/key.rs b/crates/atuin/src/command/client/search/keybindings/key.rs index 717b406d..c2eb31c6 100644 --- a/crates/atuin/src/command/client/search/keybindings/key.rs +++ b/crates/atuin/src/command/client/search/keybindings/key.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// A single key press with modifiers (e.g. `ctrl-c`, `alt-f`, `enter`). #[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] pub struct SingleKey { pub code: KeyCodeValue, pub ctrl: bool, diff --git a/crates/atuin/src/command/client/search/keybindings/keymap.rs b/crates/atuin/src/command/client/search/keybindings/keymap.rs index 8c7fcfa8..0d362863 100644 --- a/crates/atuin/src/command/client/search/keybindings/keymap.rs +++ b/crates/atuin/src/command/client/search/keybindings/keymap.rs @@ -100,7 +100,7 @@ impl Keymap { } /// Merge another keymap into this one. Keys from `other` override keys in `self`. - #[allow(dead_code)] + #[expect(dead_code)] pub fn merge(&mut self, other: &Keymap) { for (key, binding) in &other.bindings { self.bindings.insert(key.clone(), binding.clone()); diff --git a/crates/atuin/src/command/client/search/keybindings/mod.rs b/crates/atuin/src/command/client/search/keybindings/mod.rs index a9454b0d..3b6eb2b2 100644 --- a/crates/atuin/src/command/client/search/keybindings/mod.rs +++ b/crates/atuin/src/command/client/search/keybindings/mod.rs @@ -5,10 +5,10 @@ pub mod key; pub mod keymap; pub use actions::Action; -#[allow(unused_imports)] +#[expect(unused_imports)] pub use conditions::{ConditionAtom, ConditionExpr, EvalContext}; pub use defaults::KeymapSet; -#[allow(unused_imports)] +#[expect(unused_imports)] pub use key::{KeyCodeValue, KeyInput, SingleKey}; -#[allow(unused_imports)] +#[expect(unused_imports)] pub use keymap::{KeyBinding, KeyRule, Keymap}; diff --git a/crates/atuin/src/command/client/sync.rs b/crates/atuin/src/command/client/sync.rs index 12f0cacd..76dd6eeb 100644 --- a/crates/atuin/src/command/client/sync.rs +++ b/crates/atuin/src/command/client/sync.rs @@ -99,7 +99,7 @@ async fn run( let history_length = db.history_count(true).await?; let store_history_length = store.len_tag("history").await?; - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] if history_length as u64 > store_history_length { println!( "{history_length} in history index, but {store_history_length} in history store" diff --git a/crates/atuin/src/command/client/wrapped.rs b/crates/atuin/src/command/client/wrapped.rs index 82b4cd5b..0e0c9f14 100644 --- a/crates/atuin/src/command/client/wrapped.rs +++ b/crates/atuin/src/command/client/wrapped.rs @@ -19,7 +19,7 @@ struct WrappedStats { } impl WrappedStats { - #[allow(clippy::too_many_lines, clippy::cast_precision_loss)] + #[expect(clippy::too_many_lines, clippy::cast_precision_loss)] fn new(settings: &Settings, stats: &Stats, history: &[atuin_client::history::History]) -> Self { let nav_commands = stats .top @@ -170,7 +170,7 @@ pub fn print_wrapped_header(year: i32) { println!(); } -#[allow(clippy::cast_precision_loss)] +#[expect(clippy::cast_precision_loss)] fn print_fun_facts(wrapped_stats: &WrappedStats, stats: &Stats, year: i32) { let reset = ResetColor; let bold = SetAttribute(crossterm::style::Attribute::Bold); diff --git a/crates/atuin/src/command/mod.rs b/crates/atuin/src/command/mod.rs index 6cd221a4..8aac4062 100644 --- a/crates/atuin/src/command/mod.rs +++ b/crates/atuin/src/command/mod.rs @@ -15,7 +15,7 @@ mod external; #[derive(Subcommand)] #[command(infer_subcommands = true)] -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] pub enum AtuinCmd { #[cfg(feature = "client")] #[command(flatten)] diff --git a/crates/atuin/tests/common/mod.rs b/crates/atuin/tests/common/mod.rs index 0a7c5275..228c0d17 100644 --- a/crates/atuin/tests/common/mod.rs +++ b/crates/atuin/tests/common/mod.rs @@ -90,7 +90,7 @@ pub async fn register_inner<'a>( .unwrap() } -#[allow(dead_code)] +#[expect(dead_code)] pub async fn login(address: &str, username: String, password: String) -> api_client::Client<'_> { // registration works let login_response = api_client::login( @@ -109,7 +109,7 @@ pub async fn login(address: &str, username: String, password: String) -> api_cli .unwrap() } -#[allow(dead_code)] +#[expect(dead_code)] pub async fn register(address: &str) -> api_client::Client<'_> { let username = uuid_v7().as_simple().to_string(); let password = uuid_v7().as_simple().to_string(); |
