From b8e24a551cc3afb3458c64804a0652e93fcba92f Mon Sep 17 00:00:00 2001 From: qkzk Date: Wed, 27 Sep 2023 16:07:23 +0200 Subject: replace option unwrap by context --- src/event_exec.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/event_exec.rs') diff --git a/src/event_exec.rs b/src/event_exec.rs index 3a86a2b..cc1e7f2 100644 --- a/src/event_exec.rs +++ b/src/event_exec.rs @@ -837,8 +837,12 @@ impl EventAction { return Ok(()); }; if let Mode::Normal | Mode::Tree = status.selected_non_mut().mode { - let first_path = &status.flagged.content[0].to_str().unwrap(); - let second_path = &status.flagged.content[1].to_str().unwrap(); + let first_path = &status.flagged.content[0] + .to_str() + .context("Couldn't parse filename")?; + let second_path = &status.flagged.content[1] + .to_str() + .context("Couldn't parse filename")?; status.selected().preview = Preview::diff(first_path, second_path)?; let tab = status.selected(); tab.window.reset(tab.preview.len()); -- cgit v1.2.3