Skip to content

Commit ef321d6

Browse files
committed
Use strip_prefix()
1 parent 31b411f commit ef321d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/file_assoc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub fn install_file_association() -> MainResult<()> {
1414

1515
// We have to remove the `\\?\` prefix because, if we don't, the shell freaks out.
1616
let rust_script_path = rust_script_path.to_string_lossy();
17-
let rust_script_path = if rust_script_path.starts_with(r#"\\?\"#) {
18-
&rust_script_path[4..]
17+
let rust_script_path = if let Some(stripped) = rust_script_path.strip_prefix(r#"\\?\"#) {
18+
stripped
1919
} else {
20-
&rust_script_path[..]
20+
rust_script_path
2121
};
2222

2323
let res = (|| -> io::Result<()> {

0 commit comments

Comments
 (0)