Skip to content

Commit bb7ded9

Browse files
[autofix.ci] apply automated fixes
1 parent 5cada0f commit bb7ded9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

crates/oxc_language_server/src/uri_ext.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
use std::{path::{Path, PathBuf}, str::FromStr};
1+
use std::{
2+
path::{Path, PathBuf},
3+
str::FromStr,
4+
};
25

36
use percent_encoding::AsciiSet;
47
use tower_lsp_server::lsp_types::Uri;
58

69
fn path_to_uri(path: &PathBuf) -> Uri {
710
let path_str = normalize_path_with_utf8_percent_encode(path);
8-
Uri::from_str(&format!("file://{}", path_str.to_string_lossy())).expect("Failed to create URI from path")
11+
Uri::from_str(&format!("file://{}", path_str.to_string_lossy()))
12+
.expect("Failed to create URI from path")
913
}
1014

1115
const ASCII_SET: AsciiSet = percent_encoding::NON_ALPHANUMERIC.remove(b'.');
@@ -28,7 +32,10 @@ pub fn normalize_path_with_utf8_percent_encode<P: AsRef<Path>>(path: P) -> PathB
2832
}
2933
std::path::Component::Normal(part) => {
3034
// Normal components are added to the path
31-
result.push(percent_encoding::utf8_percent_encode(&part.to_str().unwrap(), &ASCII_SET).to_string());
35+
result.push(
36+
percent_encoding::utf8_percent_encode(&part.to_str().unwrap(), &ASCII_SET)
37+
.to_string(),
38+
);
3239
}
3340
_ => {}
3441
}
@@ -42,7 +49,6 @@ mod test {
4249

4350
use crate::uri_ext::path_to_uri;
4451

45-
4652
#[test]
4753
fn test_path_to_uri() {
4854
let path = PathBuf::from("/some/path/to/file.txt");

0 commit comments

Comments
 (0)