[GH-ISSUE #820] Cannot build with fzf since v0.21.0 #1423

Closed
opened 2026-03-14 14:53:21 +03:00 by kerem · 1 comment
Owner

Originally created by @bashtoni on GitHub (Sep 1, 2025).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/820

Describe the bug
When trying to build with fzf this error is shown:

error[E0425]: cannot find function `fuzzy_search_items` in this scope
   --> /home/sam/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spotify_player-0.21.0/src/utils.rs:61:12
    |
61  |     return fuzzy_search_items(items, &query);
    |            ^^^^^^^^^^^^^^^^^^ not found in this scope
    |
note: function `crate::state::ui::fuzzy_search_items` exists but is inaccessible
   --> /home/sam/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spotify_player-0.21.0/src/state/ui/mod.rs:105:1
    |
105 | fn fuzzy_search_items<'a, T: std::fmt::Display>(items: &'a [T], query: &str) -> Vec<&'a T> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible

If I drop fzf from the list of features it builds correctly.

To Reproduce

cargo install spotify_player --features image,pulseaudio-backend,fzf,streaming,media-control, --no-default-features --locked --force

Expected behaviour
Build correctly

Log and backtrace
Log and backtrace of a run reproducing the bug to help debug the issue, which are usually located in $HOME/.cache/spotify-player/.

Please refer to this URL for more details.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • OS: Fedora 42
  • Application version: v0.21.0
  • Rust version: rustc 1.89.0 (29483883e 2025-08-04) (Fedora 1.89.0-2.fc42)
Originally created by @bashtoni on GitHub (Sep 1, 2025). Original GitHub issue: https://github.com/aome510/spotify-player/issues/820 **Describe the bug** When trying to build with fzf this error is shown: ``` error[E0425]: cannot find function `fuzzy_search_items` in this scope --> /home/sam/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spotify_player-0.21.0/src/utils.rs:61:12 | 61 | return fuzzy_search_items(items, &query); | ^^^^^^^^^^^^^^^^^^ not found in this scope | note: function `crate::state::ui::fuzzy_search_items` exists but is inaccessible --> /home/sam/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spotify_player-0.21.0/src/state/ui/mod.rs:105:1 | 105 | fn fuzzy_search_items<'a, T: std::fmt::Display>(items: &'a [T], query: &str) -> Vec<&'a T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible ``` If I drop fzf from the list of features it builds correctly. **To Reproduce** ```bash cargo install spotify_player --features image,pulseaudio-backend,fzf,streaming,media-control, --no-default-features --locked --force ``` **Expected behaviour** Build correctly **Log and backtrace** Log and backtrace of a run reproducing the bug to help debug the issue, which are usually located in `$HOME/.cache/spotify-player/`. Please refer to [this URL](https://github.com/aome510/spotify-player?tab=readme-ov-file#logging) for more details. **Screenshots** If applicable, add screenshots to help explain your problem. **Environment** - OS: Fedora 42 - Application version: v0.21.0 - Rust version: rustc 1.89.0 (29483883e 2025-08-04) (Fedora 1.89.0-2.fc42)
kerem 2026-03-14 14:53:21 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Dragonfly911117 commented on GitHub (Sep 1, 2025):

I've open a PR to fix this. Meanwhile, one can download and apply this patch(or checkout my hotfix branch), then build it.

diff --git a/spotify_player/src/state/ui/mod.rs b/spotify_player/src/state/ui/mod.rs
index 1e62750..f44a684 100644
--- a/spotify_player/src/state/ui/mod.rs
+++ b/spotify_player/src/state/ui/mod.rs
@@ -97,26 +97,8 @@ impl UIState {
     }
 }
 
-#[cfg(feature = "fzf")]
-use fuzzy_matcher::skim::SkimMatcherV2;
 use ratatui::layout::Rect;
 
-#[cfg(feature = "fzf")]
-fn fuzzy_search_items<'a, T: std::fmt::Display>(items: &'a [T], query: &str) -> Vec<&'a T> {
-    let matcher = SkimMatcherV2::default();
-    let mut result = items
-        .iter()
-        .filter_map(|t| {
-            matcher
-                .fuzzy(&t.to_string(), query, false)
-                .map(|(score, _)| (t, score))
-        })
-        .collect::<Vec<_>>();
-
-    result.sort_by(|(_, a), (_, b)| b.cmp(a));
-    result.into_iter().map(|(t, _)| t).collect::<Vec<_>>()
-}
-
 impl Default for UIState {
     fn default() -> Self {
         Self {
diff --git a/spotify_player/src/utils.rs b/spotify_player/src/utils.rs
index cc90731..4e0c6c0 100644
--- a/spotify_player/src/utils.rs
+++ b/spotify_player/src/utils.rs
@@ -50,6 +50,26 @@ pub fn parse_uri(uri: &str) -> Cow<'_, str> {
     }
 }
 
+
+#[cfg(feature = "fzf")]
+use fuzzy_matcher::skim::SkimMatcherV2;
+
+#[cfg(feature = "fzf")]
+pub fn fuzzy_search_items<'a, T: std::fmt::Display>(items: &'a [T], query: &str) -> Vec<&'a T> {
+    let matcher = SkimMatcherV2::default();
+    let mut result = items
+        .iter()
+        .filter_map(|t| {
+            matcher
+                .fuzzy(&t.to_string(), query, false)
+                .map(|(score, _)| (t, score))
+        })
+        .collect::<Vec<_>>();
+
+    result.sort_by(|(_, a), (_, b)| b.cmp(a));
+    result.into_iter().map(|(t, _)| t).collect::<Vec<_>>()
+}
+
 /// Get a list of items filtered by a search query.
 pub fn filtered_items_from_query<'a, T: std::fmt::Display>(
     query: &str,

Copy and save the above patch as <name>.patch in the root directory of this repo, then

git apply <name>.patch
cargo install spotify_player --path ./spotify_player  --features image,pulseaudio-backend,fzf,streaming,media-control, --no-default-features --locked --force
<!-- gh-comment-id:3242488629 --> @Dragonfly911117 commented on GitHub (Sep 1, 2025): I've open a PR to fix this. Meanwhile, one can download and apply this patch(or checkout [my hotfix branch](https://github.com/Dragonfly911117/spotify-player/tree/fix-fzf)), then build it. ```patch diff --git a/spotify_player/src/state/ui/mod.rs b/spotify_player/src/state/ui/mod.rs index 1e62750..f44a684 100644 --- a/spotify_player/src/state/ui/mod.rs +++ b/spotify_player/src/state/ui/mod.rs @@ -97,26 +97,8 @@ impl UIState { } } -#[cfg(feature = "fzf")] -use fuzzy_matcher::skim::SkimMatcherV2; use ratatui::layout::Rect; -#[cfg(feature = "fzf")] -fn fuzzy_search_items<'a, T: std::fmt::Display>(items: &'a [T], query: &str) -> Vec<&'a T> { - let matcher = SkimMatcherV2::default(); - let mut result = items - .iter() - .filter_map(|t| { - matcher - .fuzzy(&t.to_string(), query, false) - .map(|(score, _)| (t, score)) - }) - .collect::<Vec<_>>(); - - result.sort_by(|(_, a), (_, b)| b.cmp(a)); - result.into_iter().map(|(t, _)| t).collect::<Vec<_>>() -} - impl Default for UIState { fn default() -> Self { Self { diff --git a/spotify_player/src/utils.rs b/spotify_player/src/utils.rs index cc90731..4e0c6c0 100644 --- a/spotify_player/src/utils.rs +++ b/spotify_player/src/utils.rs @@ -50,6 +50,26 @@ pub fn parse_uri(uri: &str) -> Cow<'_, str> { } } + +#[cfg(feature = "fzf")] +use fuzzy_matcher::skim::SkimMatcherV2; + +#[cfg(feature = "fzf")] +pub fn fuzzy_search_items<'a, T: std::fmt::Display>(items: &'a [T], query: &str) -> Vec<&'a T> { + let matcher = SkimMatcherV2::default(); + let mut result = items + .iter() + .filter_map(|t| { + matcher + .fuzzy(&t.to_string(), query, false) + .map(|(score, _)| (t, score)) + }) + .collect::<Vec<_>>(); + + result.sort_by(|(_, a), (_, b)| b.cmp(a)); + result.into_iter().map(|(t, _)| t).collect::<Vec<_>>() +} + /// Get a list of items filtered by a search query. pub fn filtered_items_from_query<'a, T: std::fmt::Display>( query: &str, ``` Copy and save the above patch as `<name>.patch` in the root directory of this repo, then ``` git apply <name>.patch cargo install spotify_player --path ./spotify_player --features image,pulseaudio-backend,fzf,streaming,media-control, --no-default-features --locked --force ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#1423
No description provided.