diff options
author | Benjamin Coenen <[email protected]> | 2020-05-21 09:53:29 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-05-21 09:53:29 +0100 |
commit | a7c8aa7c60c05db66ba4e89ae9e05c82e62507a5 (patch) | |
tree | e848f47bdf5d031c408df94222f595d2efcb2070 /crates/stdx | |
parent | c6143742bd4e625d391ac3ea860be7578ab9f53f (diff) | |
parent | a4e6963a2313971fe7bbec97d03bc67266ef68a9 (diff) |
add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/stdx')
-rw-r--r-- | crates/stdx/src/lib.rs | 8 |
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 | |||
120 | pub 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 | } | ||