File tree Expand file tree Collapse file tree 11 files changed +13
-19
lines changed Expand file tree Collapse file tree 11 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ pub fn stage_hunk(
25
25
26
26
let mut opt = ApplyOptions :: new ( ) ;
27
27
opt. hunk_callback ( |hunk| {
28
- hunk. map_or ( false , |hunk| {
28
+ hunk. is_some_and ( |hunk| {
29
29
let header = HunkHeader :: from ( hunk) ;
30
30
hash ( & header) == hunk_hash
31
31
} )
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ pub fn stage_lines(
51
51
let blob_id = repo. blob ( new_content. as_bytes ( ) ) ?;
52
52
53
53
idx. id = blob_id;
54
- idx. file_size = u32:: try_conv ( new_content. as_bytes ( ) . len ( ) ) ?;
54
+ idx. file_size = u32:: try_conv ( new_content. len ( ) ) ?;
55
55
index. add ( & idx) ?;
56
56
57
57
index. write ( ) ?;
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ impl FileTree {
114
114
115
115
///
116
116
pub fn move_selection ( & mut self , dir : MoveSelection ) -> bool {
117
- self . selection . map_or ( false , |selection| {
117
+ self . selection . is_some_and ( |selection| {
118
118
let new_index = match dir {
119
119
MoveSelection :: Up => {
120
120
self . selection_updown ( selection, true )
Original file line number Diff line number Diff line change @@ -634,8 +634,7 @@ impl CommitList {
634
634
) => details
635
635
. upstream
636
636
. as_ref ( )
637
- . map_or (
638
- false ,
637
+ . is_some_and (
639
638
|upstream| {
640
639
upstream. reference == remote_branch. reference
641
640
} ,
Original file line number Diff line number Diff line change @@ -339,9 +339,7 @@ impl DiffComponent {
339
339
340
340
for ( i, hunk) in diff. hunks . iter ( ) . enumerate ( ) {
341
341
let hunk_selected = self . focused ( )
342
- && self
343
- . selected_hunk
344
- . map_or ( false , |s| s == i) ;
342
+ && self . selected_hunk . is_some_and ( |s| s == i) ;
345
343
346
344
if lines_added >= height as usize {
347
345
break ;
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ impl RevisionFilesComponent {
81
81
self . show ( ) ?;
82
82
83
83
let same_id =
84
- self . revision . as_ref ( ) . map_or ( false , |c| c. id == commit) ;
84
+ self . revision . as_ref ( ) . is_some_and ( |c| c. id == commit) ;
85
85
86
86
if !same_id {
87
87
self . files = None ;
@@ -187,7 +187,7 @@ impl RevisionFilesComponent {
187
187
}
188
188
189
189
fn blame ( & self ) -> bool {
190
- self . selected_file_path ( ) . map_or ( false , |path| {
190
+ self . selected_file_path ( ) . is_some_and ( |path| {
191
191
self . queue . push ( InternalEvent :: OpenPopup (
192
192
StackablePopupOpen :: BlameFile ( BlameFileOpen {
193
193
file_path : path,
@@ -201,7 +201,7 @@ impl RevisionFilesComponent {
201
201
}
202
202
203
203
fn file_history ( & self ) -> bool {
204
- self . selected_file_path ( ) . map_or ( false , |path| {
204
+ self . selected_file_path ( ) . is_some_and ( |path| {
205
205
self . queue . push ( InternalEvent :: OpenPopup (
206
206
StackablePopupOpen :: FileRevlog ( FileRevOpen :: new (
207
207
path,
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ impl StatusTreeComponent {
120
120
121
121
///
122
122
pub fn is_file_selected ( & self ) -> bool {
123
- self . tree . selected_item ( ) . map_or ( false , |item| {
123
+ self . tree . selected_item ( ) . is_some_and ( |item| {
124
124
match item. kind {
125
125
FileTreeItemKind :: File ( _) => true ,
126
126
FileTreeItemKind :: Path ( ..) => false ,
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ impl StatusTree {
129
129
130
130
///
131
131
pub fn move_selection ( & mut self , dir : MoveSelection ) -> bool {
132
- self . selection . map_or ( false , |selection| {
132
+ self . selection . is_some_and ( |selection| {
133
133
let selection_change = match dir {
134
134
MoveSelection :: Up => {
135
135
self . selection_updown ( selection, true )
Original file line number Diff line number Diff line change @@ -124,10 +124,7 @@ impl FileRevlogPopup {
124
124
///
125
125
pub fn any_work_pending ( & self ) -> bool {
126
126
self . git_diff . is_pending ( )
127
- || self
128
- . git_log
129
- . as_ref ( )
130
- . map_or ( false , AsyncLog :: is_pending)
127
+ || self . git_log . as_ref ( ) . is_some_and ( AsyncLog :: is_pending)
131
128
}
132
129
133
130
///
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ impl FuzzyFindPopup {
190
190
. map ( |( idx, indices) | {
191
191
let selected = self
192
192
. selected_index
193
- . map_or ( false , |index| index == * idx) ;
193
+ . is_some_and ( |index| index == * idx) ;
194
194
let full_text =
195
195
trim_length_left ( & self . contents [ * idx] , width) ;
196
196
let trim_length =
Original file line number Diff line number Diff line change @@ -448,7 +448,7 @@ impl TagListPopup {
448
448
let is_tag_missing_on_remote = self
449
449
. missing_remote_tags
450
450
. as_ref ( )
451
- . map_or ( false , |missing_remote_tags| {
451
+ . is_some_and ( |missing_remote_tags| {
452
452
let remote_tag = format ! ( "refs/tags/{}" , tag. name) ;
453
453
454
454
missing_remote_tags. contains ( & remote_tag)
You can’t perform that action at this time.
0 commit comments