Skip to content

Commit 6cee321

Browse files
committed
Migrate to is_some_and
1 parent fc26ba5 commit 6cee321

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/modules/list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl List {
374374
let selected_line_index = todo_file.get_selected_line_index();
375375
let next_action_is_break = todo_file
376376
.get_line(selected_line_index + 1)
377-
.map_or(false, |line| line.get_action() == &Action::Break);
377+
.is_some_and(|line| line.get_action() == &Action::Break);
378378

379379
// no need to add an additional break when the next line is already a break
380380
if next_action_is_break {
@@ -383,7 +383,7 @@ impl List {
383383

384384
let selected_action_is_break = todo_file
385385
.get_line(selected_line_index)
386-
.map_or(false, |line| line.get_action() == &Action::Break);
386+
.is_some_and(|line| line.get_action() == &Action::Break);
387387

388388
let cursor_update = if selected_action_is_break {
389389
todo_file.remove_lines(selected_line_index, selected_line_index);
@@ -466,7 +466,7 @@ impl List {
466466
if context.is_full_width() {
467467
todo_line_segment_options.insert(TodoLineSegmentsOptions::FULL_WIDTH);
468468
}
469-
if search_index.map_or(false, |v| v.index() == index) {
469+
if search_index.is_some_and(|v| v.index() == index) {
470470
todo_line_segment_options.insert(TodoLineSegmentsOptions::SEARCH_LINE);
471471
}
472472
let mut view_line = ViewLine::new_with_pinned_segments(

src/modules/list/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub(super) fn get_todo_line_segments(
300300
Action::Drop | Action::Edit | Action::Fixup | Action::Pick | Action::Reword | Action::Squash => {
301301
let action_width = if is_full_width { 8 } else { 3 };
302302
let max_index = cmp::min(line.get_hash().len(), action_width);
303-
let search_hash_match = search_match.map_or(false, |m| m.hash());
303+
let search_hash_match = search_match.is_some_and(|m| m.hash());
304304

305305
segments.push(LineSegment::new_with_color_and_style(
306306
format!(
@@ -330,7 +330,7 @@ pub(super) fn get_todo_line_segments(
330330

331331
let content = line.get_content();
332332
if !content.is_empty() {
333-
let search_content_match = search_match.map_or(false, |m| m.content());
333+
let search_content_match = search_match.is_some_and(|m| m.content());
334334
if_chain! {
335335
if search_content_match;
336336
if let Some(term) = search_term;

0 commit comments

Comments
 (0)