From ac164ada68077f37c47ec9fc25baa1aef7f95e6c Mon Sep 17 00:00:00 2001 From: Cyprien de Saint Guilhem Date: Fri, 11 Oct 2024 17:13:31 +0200 Subject: [PATCH] Simplify Option matching --- src/format.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/format.rs b/src/format.rs index fd9ff0a..9e5a913 100644 --- a/src/format.rs +++ b/src/format.rs @@ -72,15 +72,9 @@ pub fn format_file( if needs_wrap(&line, &temp_state, args) { let wrapped_lines = apply_wrap(&line, &temp_state, file, args, logs); - if wrapped_lines.is_some() { - queue.push(( - linum_old, - wrapped_lines.clone().unwrap().1, - )); - queue.push(( - linum_old, - wrapped_lines.clone().unwrap().0, - )); + if let Some((this_line, next_line)) = wrapped_lines { + queue.push((linum_old, next_line)); + queue.push((linum_old, this_line)); continue; } }