Simplify replace dashes with underscore
commitbda4f5c1cdd2f84a06647f7dce45a8f6d06401ae
authorIvan Tham <pickfire@riseup.net>
dateFri 23 Jul 2021, 17:02 (5 years ago)
parent1789dfa
helix-syntax/src/lib.rs+1−9
@@ -3,15 +3,7 @@ use libloading::{Library, Symbol};
33use tree_sitter::Language;
44
55fn replace_dashes_with_underscores(name: &str) -> String {
6− let mut result = String::with_capacity(name.len());
7− for c in name.chars() {
8− if c == '-' {
9− result.push('_');
10− } else {
11− result.push(c);
12− }
13− }
14− result
6+ name.replace('-', "_")
157}
168#[cfg(unix)]
179const DYLIB_EXTENSION: &str = "so";