Merge the match arms

This commit is contained in:
sxyazi 2025-01-04 10:38:26 +08:00
parent 8e9eed408c
commit a652aab632
No known key found for this signature in database

View file

@ -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 => {