aboutsummaryrefslogtreecommitdiff
path: root/crates/stdx/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/stdx/src')
-rw-r--r--crates/stdx/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs
index 0f34ce70e..71a57fba2 100644
--- a/crates/stdx/src/lib.rs
+++ b/crates/stdx/src/lib.rs
@@ -116,3 +116,11 @@ pub fn to_lower_snake_case(s: &str) -> String {
116 } 116 }
117 buf 117 buf
118} 118}
119
120pub fn replace(buf: &mut String, from: char, to: &str) {
121 if !buf.contains(from) {
122 return;
123 }
124 // FIXME: do this in place.
125 *buf = buf.replace(from, to)
126}