on master help sign in
Simplify replace dashes with underscore
bda4f5cIvan Tham
helix-syntax/src/lib.rs+1−9
@@ -3,15 +3,7 @@ use libloading::{Library, Symbol};
3use tree_sitter::Language;
3use tree_sitter::Language;
4
4
5fn replace_dashes_with_underscores(name: &str) -> String {
5fn replace_dashes_with_underscores(name: &str) -> String {
6− let mut result = String::with_capacity(name.len());
6+ name.replace('-', "_")
7− for c in name.chars() {
8− if c == '-' {
9− result.push('_');
10− } else {
11− result.push(c);
12− }
13− }
14− result
15}
7}
16#[cfg(unix)]
8#[cfg(unix)]
17const DYLIB_EXTENSION: &str = "so";
9const DYLIB_EXTENSION: &str = "so";