improve patch
This commit is contained in:
1 parent
d72163160e
commit
0a52e4321f
2 files changed
+5
-10
No files matched your search
+3
-5
@@ -155,11 +155,9 @@ pub fn sanitize(line: &str) -> String {
|
||||
let bytes = stripped.as_bytes();
|
||||
let mut start = 0;
|
||||
let mut i = 0;
|
||||
while i < bytes.len() {
|
||||
if !is_sanitize_trigger(bytes[i]) {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
// Skip directly to the next trigger byte instead of testing each one.
|
||||
while let Some(off) = bytes[i..].iter().position(|&b| is_sanitize_trigger(b)) {
|
||||
i += off;
|
||||
let len = sanitize_at(bytes, i, &stripped, &mut buffer, &mut start);
|
||||
i += len;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user