From 9282527cb931e9776f7e739bf374c916244098d4 Mon Sep 17 00:00:00 2001 From: Ian Manske Date: Sat, 6 Jul 2024 11:44:32 -0700 Subject: [PATCH] Add `cold` optimization --- crates/nu-protocol/src/pipeline/interrupt.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/nu-protocol/src/pipeline/interrupt.rs b/crates/nu-protocol/src/pipeline/interrupt.rs index eef54f6915..78bb40dcea 100644 --- a/crates/nu-protocol/src/pipeline/interrupt.rs +++ b/crates/nu-protocol/src/pipeline/interrupt.rs @@ -24,8 +24,14 @@ impl Interrupt { #[inline] pub fn check(&self, span: Span) -> Result<(), ShellError> { - if self.triggered() { + #[inline] + #[cold] + fn interrupt_error(span: Span) -> Result<(), ShellError> { Err(ShellError::Interrupted { span }) + } + + if self.triggered() { + interrupt_error(span) } else { Ok(()) }