diff --git a/src/cli/self_update/windows.rs b/src/cli/self_update/windows.rs index a3e605d01d5..e1bc825b8a7 100644 --- a/src/cli/self_update/windows.rs +++ b/src/cli/self_update/windows.rs @@ -595,11 +595,11 @@ fn _remove_from_path(old_path: String, path_str: String) -> Option { // for that to find the string, because if it's the last string in the path, // there may not be. let mut len = path_str.len(); - if old_path.chars().collect::>()[idx + path_str.len() - 1] == ';' { + if old_path.as_bytes().get(idx + path_str.len()) == Some(&b';') { len += 1; } - let mut new_path = old_path[..idx].to_string(); + let mut new_path = old_path[..idx].to_owned(); new_path += &old_path[idx + len..]; // Don't leave a trailing ; though, we don't want an empty string in the // path.