tui-core: Speed up label line break cleanup
1ac97113fe14b50a552bac62d0a8377f6be350d9
Avoids an unnecessary allocation while removing line breaks from labels.
1 parent
a7e91867
crates/tui-core/src/label.rs
+1 -1
| 183 | 183 | Label::from(s.into()) |
|
| 184 | 184 | } |
|
| 185 | 185 | ||
| 186 | 186 | /// Removes unsupported label line breaks. |
|
| 187 | 187 | fn clean(mut input: String) -> String { |
|
| 188 | - | if input.contains(['\n', '\r']) { |
|
| 188 | + | if input.as_bytes().contains(&b'\n') || input.as_bytes().contains(&b'\r') { |
|
| 189 | 189 | input.retain(|c| c != '\n' && c != '\r'); |
|
| 190 | 190 | } |
|
| 191 | 191 | input |
|
| 192 | 192 | } |