From ff6019827311bef42f2d49a5f37166e3747e4127 Mon Sep 17 00:00:00 2001 From: Nik Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Wed, 19 Mar 2025 00:04:54 +0000 Subject: [PATCH] chore: remove unnecessary panic!s --- helix-term/src/handlers/blame.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/helix-term/src/handlers/blame.rs b/helix-term/src/handlers/blame.rs index 67b2b877..eef0201b 100644 --- a/helix-term/src/handlers/blame.rs +++ b/helix-term/src/handlers/blame.rs @@ -76,20 +76,17 @@ pub(super) fn register_hooks(handlers: &Handlers) { let tx = handlers.blame.clone(); register_hook!(move |event: &mut PostCommand<'_, '_>| { if event.cx.editor.config().vcs.blame { - let blame_enabled = event.cx.editor.config().vcs.blame; let (view, doc) = current!(event.cx.editor); let text = doc.text(); let selection = doc.selection(view.id); let Some(file) = doc.path() else { - panic!(); + return Ok(()); }; - if !blame_enabled { - panic!(); - } - let cursor_lin = text.char_to_line(selection.primary().cursor(doc.text().slice(..))); - let Ok(cursor_line) = TryInto::<u32>::try_into(cursor_lin) else { - panic!(); + let Ok(cursor_line) = TryInto::<u32>::try_into( + text.char_to_line(selection.primary().cursor(doc.text().slice(..))), + ) else { + return Ok(()); }; send_blocking(