diff --git a/CHANGELOG.md b/CHANGELOG.md index e03efa8f..35488885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.20.5](https://github.com/skim-rs/skim/compare/v0.20.4...v0.20.5) - 2025-08-09 + +### 🐛 Bug Fixes + +- compile without the cli feature ([#834](https://github.com/skim-rs/skim/pull/834)) + ## [0.20.4](https://github.com/skim-rs/skim/compare/v0.20.3...v0.20.4) - 2025-08-02 ### 🐛 Bug Fixes diff --git a/Cargo.lock b/Cargo.lock index 8bd8e378..01c2510a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.19" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", @@ -58,22 +58,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.9" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -125,9 +125,9 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "cc" -version = "1.2.31" +version = "1.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" +checksum = "2352e5597e9c544d5e6d9c95190d5d27738ade584fa8db0a16e130e5c2b5296e" dependencies = [ "shlex", ] @@ -160,9 +160,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.42" +version = "4.5.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" +checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f" dependencies = [ "clap_builder", "clap_derive", @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.42" +version = "4.5.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" +checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65" dependencies = [ "anstream", "anstyle", @@ -182,9 +182,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.55" +version = "4.5.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5abde44486daf70c5be8b8f8f1b66c49f86236edf6fa2abadb4d961c4c6229a" +checksum = "67e4efcbb5da11a92e8a609233aa1e8a7d91e38de0be865f016d14700d45a7fd" dependencies = [ "clap", ] @@ -519,9 +519,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.4" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "heck" @@ -863,9 +863,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "serde" @@ -904,7 +904,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "skim" -version = "0.20.4" +version = "0.20.5" dependencies = [ "beef", "bitflags 1.3.2", @@ -939,7 +939,7 @@ version = "0.2.0" [[package]] name = "skim-tuikit" -version = "0.6.5" +version = "0.6.6" dependencies = [ "bitflags 1.3.2", "env_logger", diff --git a/man/man1/sk.1 b/man/man1/sk.1 index aed5dc31..17c1c820 100644 --- a/man/man1/sk.1 +++ b/man/man1/sk.1 @@ -1,6 +1,6 @@ .ie \n(.g .ds Aq \(aq .el .ds Aq ' -.TH sk 1 "sk 0.20.4" +.TH sk 1 "sk 0.20.5" .SH NAME sk \- sk \- fuzzy finder in Rust .SH SYNOPSIS @@ -753,4 +753,4 @@ Note: While PowerShell completions are supported, Windows is not supported for n .br [\fIpossible values: \fRbash, elvish, fish, powershell, zsh] .SH VERSION -v0.20.4 +v0.20.5 diff --git a/skim-common/src/spinlock.rs b/skim-common/src/spinlock.rs index afa240aa..3778a1b0 100644 --- a/skim-common/src/spinlock.rs +++ b/skim-common/src/spinlock.rs @@ -42,7 +42,7 @@ impl SpinLock { } impl SpinLock { - pub fn lock(&self) -> SpinLockGuard { + pub fn lock(&self) -> SpinLockGuard<'_, T> { while self .locked .compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) @@ -130,7 +130,7 @@ mod tests { #[test] fn test_mutex_unsized() { - let mutex: &SpinLock<[i32]> = &SpinLock::new([1, 2, 3]); + let mutex = SpinLock::new([1, 2, 3]); { let b = &mut *mutex.lock(); b[0] = 4; diff --git a/skim-tuikit/Cargo.toml b/skim-tuikit/Cargo.toml index ed78756a..afcf3bfe 100644 --- a/skim-tuikit/Cargo.toml +++ b/skim-tuikit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "skim-tuikit" -version = "0.6.5" +version = "0.6.6" authors = ["Jinzhou Zhang "] description = "Toolkit for writing TUI applications" documentation = "https://docs.rs/skim-tuikit" diff --git a/skim-tuikit/src/input.rs b/skim-tuikit/src/input.rs index 5f4db72b..66532a6f 100644 --- a/skim-tuikit/src/input.rs +++ b/skim-tuikit/src/input.rs @@ -444,10 +444,9 @@ impl KeyBoard { let pos_semi = self.byte_buf.iter().position(|&b| b == b';'); let pos_r = self.byte_buf.iter().position(|&b| b == b'R'); - if pos_semi.is_some() && pos_r.is_some() { - let pos_semi = pos_semi.unwrap(); - let pos_r = pos_r.unwrap(); - + if let Some(pos_semi) = pos_semi + && let Some(pos_r) = pos_r + { if pos_r > pos_semi { let remain = self.byte_buf.split_off(pos_r + 1); let mut col_str = self.byte_buf.split_off(pos_semi + 1); diff --git a/skim-tuikit/src/output.rs b/skim-tuikit/src/output.rs index cf7d5c69..497b8d2c 100644 --- a/skim-tuikit/src/output.rs +++ b/skim-tuikit/src/output.rs @@ -55,10 +55,10 @@ impl Output { } fn write_cap_with_params(&mut self, cap: &str, params: &[Param]) { - if let Some(cmd) = self.terminfo.strings.get(cap) { - if let Ok(s) = expand(cmd, params, &mut Variables::new()) { - self.buffer.extend(&s); - } + if let Some(cmd) = self.terminfo.strings.get(cap) + && let Ok(s) = expand(cmd, params, &mut Variables::new()) + { + self.buffer.extend(&s); } } diff --git a/skim-tuikit/src/raw.rs b/skim-tuikit/src/raw.rs index 0b8a6e1b..0eb51e82 100644 --- a/skim-tuikit/src/raw.rs +++ b/skim-tuikit/src/raw.rs @@ -75,7 +75,7 @@ impl Write for RawTerminal { } impl AsFd for RawTerminal { - fn as_fd(&self) -> BorrowedFd { + fn as_fd(&self) -> BorrowedFd<'_> { self.output.as_fd() } } diff --git a/skim-tuikit/src/screen.rs b/skim-tuikit/src/screen.rs index e14d9e71..14ddaeb6 100644 --- a/skim-tuikit/src/screen.rs +++ b/skim-tuikit/src/screen.rs @@ -211,7 +211,7 @@ impl Screen { /// assert_eq!(Some((0, 0, &Cell{ ch: 'a', ..Cell::default()})), iter.next()); /// assert_eq!(None, iter.next()); /// ``` - pub fn iter_cell(&self) -> CellIterator { + pub fn iter_cell(&self) -> CellIterator<'_> { CellIterator { width: self.width, index: 0, diff --git a/skim/Cargo.toml b/skim/Cargo.toml index 7d4bb714..f145d9d2 100644 --- a/skim/Cargo.toml +++ b/skim/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "skim" -version = "0.20.4" +version = "0.20.5" authors = ["Zhang Jinzhou ", "Loric Andre"] description = "Fuzzy Finder in rust!" documentation = "https://docs.rs/skim" @@ -39,7 +39,7 @@ regex = { workspace = true } shell-quote = { workspace = true } shlex = { workspace = true, optional = true } skim-common = { path = "../skim-common/", version = "0.2.0" } -skim-tuikit = { path = "../skim-tuikit/", version = "0.6.5" } +skim-tuikit = { path = "../skim-tuikit/", version = "0.6.6" } time = { workspace = true } timer = { workspace = true } unicode-width = { workspace = true } diff --git a/skim/src/helper/item.rs b/skim/src/helper/item.rs index fdbf4c35..f4a5bbc9 100644 --- a/skim/src/helper/item.rs +++ b/skim/src/helper/item.rs @@ -93,11 +93,11 @@ impl DefaultSkimItem { impl SkimItem for DefaultSkimItem { #[inline] - fn text(&self) -> Cow { + fn text(&self) -> Cow<'_, str> { Cow::Borrowed(self.text.stripped()) } - fn output(&self) -> Cow { + fn output(&self) -> Cow<'_, str> { if self.orig_text.is_some() { if self.text.has_attrs() { let mut ansi_parser: ANSIParser = Default::default(); diff --git a/skim/src/input.rs b/skim/src/input.rs index a2340b42..f8045fff 100644 --- a/skim/src/input.rs +++ b/skim/src/input.rs @@ -87,7 +87,7 @@ type KeyActions<'a> = (&'a str, Vec<(&'a str, Option)>); /// parse key action string to `(key, action, argument)` tuple /// key_action is comma separated: 'ctrl-j:accept,ctrl-k:kill-line' -pub fn parse_key_action(key_action: &str) -> Vec { +pub fn parse_key_action(key_action: &str) -> Vec> { // match `key:action` or `key:action:arg` or `key:action(arg)` etc. static RE: LazyLock = LazyLock::new(|| { Regex::new( diff --git a/skim/src/item.rs b/skim/src/item.rs index c00d4865..a69fe104 100644 --- a/skim/src/item.rs +++ b/skim/src/item.rs @@ -195,13 +195,13 @@ impl ItemPool { pool.len() } - pub fn take(&self) -> ItemPoolGuard> { + pub fn take(&self) -> ItemPoolGuard<'_, Arc> { let guard = self.pool.lock(); let taken = self.taken.swap(guard.len(), Ordering::SeqCst); ItemPoolGuard { guard, start: taken } } - pub fn reserved(&self) -> ItemPoolGuard> { + pub fn reserved(&self) -> ItemPoolGuard<'_, Arc> { let guard = self.reserved_items.lock(); ItemPoolGuard { guard, start: 0 } } diff --git a/skim/src/lib.rs b/skim/src/lib.rs index 234bfb54..1d7a3ca4 100644 --- a/skim/src/lib.rs +++ b/skim/src/lib.rs @@ -103,7 +103,7 @@ impl AsAny for T { /// ``` pub trait SkimItem: AsAny + Send + Sync + 'static { /// The string to be used for matching (without color) - fn text(&self) -> Cow; + fn text(&self) -> Cow<'_, str>; /// The content to be displayed on the item list, could contain ANSI properties fn display<'a>(&'a self, context: DisplayContext<'a>) -> AnsiString<'a> { @@ -120,7 +120,7 @@ pub trait SkimItem: AsAny + Send + Sync + 'static { /// Note that this function is intended to be used by the caller of skim and will not be used by /// skim. And since skim will return the item back in `SkimOutput`, if string is not what you /// want, you could still use `downcast` to retain the pointer to the original struct. - fn output(&self) -> Cow { + fn output(&self) -> Cow<'_, str> { self.text() } @@ -146,7 +146,7 @@ pub trait SkimItem: AsAny + Send + Sync + 'static { // Implement SkimItem for raw strings impl + Send + Sync + 'static> SkimItem for T { - fn text(&self) -> Cow { + fn text(&self) -> Cow<'_, str> { Cow::Borrowed(self.as_ref()) } } diff --git a/skim/src/model/mod.rs b/skim/src/model/mod.rs index 2813e791..806fddc3 100644 --- a/skim/src/model/mod.rs +++ b/skim/src/model/mod.rs @@ -418,13 +418,13 @@ impl Model { // Check if query meets minimum length requirement before restarting matcher // In interactive mode, the command query is used as the search query - if let Some(min_length) = self.min_query_length { - if env.cmd_query.chars().count() < min_length { - // Clear selection if query is too short - self.selection.clear(); - // Don't restart matcher if query is too short - return; - } + if let Some(min_length) = self.min_query_length + && env.cmd_query.chars().count() < min_length + { + // Clear selection if query is too short + self.selection.clear(); + // Don't restart matcher if query is too short + return; } self.restart_matcher(); @@ -443,13 +443,13 @@ impl Model { self.num_options = 0; // Check if query meets minimum length requirement - if let Some(min_length) = self.min_query_length { - if env.query.chars().count() < min_length { - // Clear selection if query is too short - self.selection.clear(); - // Don't restart matcher if query is too short - return; - } + if let Some(min_length) = self.min_query_length + && env.query.chars().count() < min_length + { + // Clear selection if query is too short + self.selection.clear(); + // Don't restart matcher if query is too short + return; } self.restart_matcher(); diff --git a/skim/src/orderedvec.rs b/skim/src/orderedvec.rs index a37bfad1..f2b1a2f4 100644 --- a/skim/src/orderedvec.rs +++ b/skim/src/orderedvec.rs @@ -131,7 +131,7 @@ impl OrderedVec { } } - pub fn get(&self, index: usize) -> Option> { + pub fn get(&self, index: usize) -> Option> { self.merge_till(index); if self.len() <= index { None @@ -160,7 +160,7 @@ impl OrderedVec { self.len() == 0 } - pub fn iter(&self) -> impl Iterator> { + pub fn iter(&self) -> impl Iterator> { self.merge_till(self.len()); OrderedVecIter { ordered_vec: self,