Skip to content

Commit b5a4aa0

Browse files
committed
Fix: correctly handle some paths
1 parent 82cc7ff commit b5a4aa0

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jumpy"
3-
version = "0.3.9"
3+
version = "0.3.10"
44
edition = "2021"
55
authors = ["Clément Nerma <[email protected]>"]
66
license = "Apache-2.0"

src/index.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,12 @@ impl Index {
7777
let mut entries = self
7878
.scored_entries
7979
.iter()
80-
.filter(|(path, _)| {
80+
.filter_map(|(path, scope)| {
8181
Path::new(path)
8282
.file_name()
83-
.unwrap()
84-
.to_str()
85-
.unwrap()
86-
.to_lowercase()
87-
.contains(&query)
83+
.and_then(|filename| filename.to_str())
84+
.filter(|filename| filename.to_lowercase().contains(&query))
85+
.map(|_| (path, scope))
8886
})
8987
.map(IndexEntry::from)
9088
.collect::<Vec<_>>();

0 commit comments

Comments
 (0)