diff options
author | Ivan Tham | 2021-07-23 09:02:42 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-07-23 09:37:41 +0000 |
commit | bda4f5c1cdd2f84a06647f7dce45a8f6d06401ae (patch) | |
tree | 1dc4cb81947c0df27902574644657488e504d712 /helix-syntax | |
parent | 1789dfabfe68c00dda3b861b828ea7a50860f6e7 (diff) |
Simplify replace dashes with underscore
Diffstat (limited to 'helix-syntax')
-rw-r--r-- | helix-syntax/src/lib.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/helix-syntax/src/lib.rs b/helix-syntax/src/lib.rs index b6c0ecf3..b0ec48d8 100644 --- a/helix-syntax/src/lib.rs +++ b/helix-syntax/src/lib.rs @@ -3,15 +3,7 @@ use libloading::{Library, Symbol}; use tree_sitter::Language; fn replace_dashes_with_underscores(name: &str) -> String { - let mut result = String::with_capacity(name.len()); - for c in name.chars() { - if c == '-' { - result.push('_'); - } else { - result.push(c); - } - } - result + name.replace('-', "_") } #[cfg(unix)] const DYLIB_EXTENSION: &str = "so"; |