Change extract_prefix_and_unescape_yaml() assert!() to debug_assert!()

It's reasonable since this is only checking to see that the history file
contains the expected format and if it's corrupted but we at least got what we
expect to be the correct key/value pairs, then that's all we can do.

Of course the real motivation is to speed up this very hot function in any way
possible!
This commit is contained in:
Mahmoud Al-Qudsi
2024-05-15 22:40:33 -05:00
parent 51275525c1
commit b82170aded

View File

@@ -317,6 +317,7 @@ fn extract_prefix_and_unescape_yaml(line: &[u8]) -> Option<(Cow<[u8]>, Cow<[u8]>
let mut split = line.splitn(2, |c| *c == b':');
let key = split.next().unwrap();
let value = split.next()?;
debug_assert!(split.next().is_none());
let key: Cow<[u8]> = if key.iter().copied().any(|b| b == b'\\') {
let mut key = key.to_owned();