From d8e9a17c1f2294b8d0ccb2e86b002d8cff61b636 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 17 May 2024 16:10:54 -0500 Subject: [PATCH] Inline extract_prefix_and_unescape_yaml() We sometimes call it but discard half its results, so force it to be inlined to make sure we don't perform work we then throw away. --- src/history/file.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/history/file.rs b/src/history/file.rs index 8b1c4c621..a8c7a7cbd 100644 --- a/src/history/file.rs +++ b/src/history/file.rs @@ -334,6 +334,10 @@ fn trim_leading_spaces(s: &[u8]) -> (usize, &[u8]) { (count, &s[count..]) } +// This function is forcibly inlined because we sometimes call it but discard one of the return +// values. Hopefully that will be sufficient for the compiler to skip the unnecessary call to +// unescape_yaml_fish_2_0() for the discarded key. +#[inline(always)] #[allow(clippy::type_complexity)] fn extract_prefix_and_unescape_yaml(line: &[u8]) -> Option<(Cow<[u8]>, Cow<[u8]>)> { let mut split = line.splitn(2, |c| *c == b':');