From b82170adedcfb5726261bea20a709d7d853c2bf5 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 15 May 2024 22:40:33 -0500 Subject: [PATCH] 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! --- src/history/file.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/history/file.rs b/src/history/file.rs index 25bb391f7..891992c19 100644 --- a/src/history/file.rs +++ b/src/history/file.rs @@ -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();