Skip to content

Commit 5da3092

Browse files
[Fix] seperator parsing for windows fix: clippy warning (#112)
Co-authored-by: kaoru <namecallfilter@users.noreply.github.com>
1 parent 8dd5b4f commit 5da3092

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

core/src/components/breadcrumbs.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::MAIN_SEPARATOR_STR;
22

33
use cosmic_text::{Attrs, Family, Metrics};
4-
use regex::Regex;
4+
use regex::{escape, Regex};
55

66
use crate::{
77
edges::margin::Margin,
@@ -42,15 +42,13 @@ impl Component for Breadcrumbs {
4242

4343
self.path
4444
.as_ref()
45-
.and_then(|path| {
46-
let (w, h) = calc_wh_with_min_width(&path, 8., LINE_HEIGHT);
47-
48-
return Some(
49-
style
50-
.clone()
51-
.size(Size::Num(w), Size::Num(h))
52-
.margin(Margin::default()),
53-
);
45+
.map(|path| {
46+
let (w, h) = calc_wh_with_min_width(path, 8., LINE_HEIGHT);
47+
48+
style
49+
.clone()
50+
.size(Size::Num(w), Size::Num(h))
51+
.margin(Margin::default())
5452
})
5553
.unwrap_or(style)
5654
}
@@ -103,7 +101,7 @@ impl Breadcrumbs {
103101
}
104102

105103
fn parse_separator(path_str: &str, separator: &str) -> String {
106-
Regex::new(MAIN_SEPARATOR_STR)
104+
Regex::new(&escape(MAIN_SEPARATOR_STR))
107105
.unwrap()
108106
.replace_all(path_str, separator)
109107
.to_string()

0 commit comments

Comments
 (0)