From a652aab632927b374517373c69569b1241349a28 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 4 Jan 2025 10:38:26 +0800 Subject: [PATCH] Merge the match arms --- yazi-core/src/input/commands/move_.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/yazi-core/src/input/commands/move_.rs b/yazi-core/src/input/commands/move_.rs index 5344a8fb..10cc1e78 100644 --- a/yazi-core/src/input/commands/move_.rs +++ b/yazi-core/src/input/commands/move_.rs @@ -60,13 +60,8 @@ enum OptStep { impl OptStep { fn cursor(self, snap: &InputSnap) -> usize { match self { - Self::Offset(n) => { - if n <= 0 { - snap.cursor.saturating_add_signed(n) - } else { - snap.count().min(snap.cursor + n as usize) - } - } + Self::Offset(n) if n <= 0 => snap.cursor.saturating_add_signed(n), + Self::Offset(n) => snap.count().min(snap.cursor + n as usize), Self::Bol => 0, Self::Eol => snap.count(), Self::FirstChar => {