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(
2525
2626 let mut opt = ApplyOptions :: new ( ) ;
2727 opt. hunk_callback ( |hunk| {
28- hunk. map_or ( false , |hunk| {
28+ hunk. is_some_and ( |hunk| {
2929 let header = HunkHeader :: from ( hunk) ;
3030 hash ( & header) == hunk_hash
3131 } )
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ pub fn stage_lines(
5151 let blob_id = repo. blob ( new_content. as_bytes ( ) ) ?;
5252
5353 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 ( ) ) ?;
5555 index. add ( & idx) ?;
5656
5757 index. write ( ) ?;
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ impl FileTree {
114114
115115 ///
116116 pub fn move_selection ( & mut self , dir : MoveSelection ) -> bool {
117- self . selection . map_or ( false , |selection| {
117+ self . selection . is_some_and ( |selection| {
118118 let new_index = match dir {
119119 MoveSelection :: Up => {
120120 self . selection_updown ( selection, true )
Original file line number Diff line number Diff line change @@ -634,8 +634,7 @@ impl CommitList {
634634 ) => details
635635 . upstream
636636 . as_ref ( )
637- . map_or (
638- false ,
637+ . is_some_and (
639638 |upstream| {
640639 upstream. reference == remote_branch. reference
641640 } ,
Original file line number Diff line number Diff line change @@ -339,9 +339,7 @@ impl DiffComponent {
339339
340340 for ( i, hunk) in diff. hunks . iter ( ) . enumerate ( ) {
341341 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) ;
345343
346344 if lines_added >= height as usize {
347345 break ;
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ impl RevisionFilesComponent {
8181 self . show ( ) ?;
8282
8383 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) ;
8585
8686 if !same_id {
8787 self . files = None ;
@@ -187,7 +187,7 @@ impl RevisionFilesComponent {
187187 }
188188
189189 fn blame ( & self ) -> bool {
190- self . selected_file_path ( ) . map_or ( false , |path| {
190+ self . selected_file_path ( ) . is_some_and ( |path| {
191191 self . queue . push ( InternalEvent :: OpenPopup (
192192 StackablePopupOpen :: BlameFile ( BlameFileOpen {
193193 file_path : path,
@@ -201,7 +201,7 @@ impl RevisionFilesComponent {
201201 }
202202
203203 fn file_history ( & self ) -> bool {
204- self . selected_file_path ( ) . map_or ( false , |path| {
204+ self . selected_file_path ( ) . is_some_and ( |path| {
205205 self . queue . push ( InternalEvent :: OpenPopup (
206206 StackablePopupOpen :: FileRevlog ( FileRevOpen :: new (
207207 path,
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ impl StatusTreeComponent {
120120
121121 ///
122122 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| {
124124 match item. kind {
125125 FileTreeItemKind :: File ( _) => true ,
126126 FileTreeItemKind :: Path ( ..) => false ,
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ impl StatusTree {
129129
130130 ///
131131 pub fn move_selection ( & mut self , dir : MoveSelection ) -> bool {
132- self . selection . map_or ( false , |selection| {
132+ self . selection . is_some_and ( |selection| {
133133 let selection_change = match dir {
134134 MoveSelection :: Up => {
135135 self . selection_updown ( selection, true )
Original file line number Diff line number Diff line change @@ -124,10 +124,7 @@ impl FileRevlogPopup {
124124 ///
125125 pub fn any_work_pending ( & self ) -> bool {
126126 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)
131128 }
132129
133130 ///
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ impl FuzzyFindPopup {
190190 . map ( |( idx, indices) | {
191191 let selected = self
192192 . selected_index
193- . map_or ( false , |index| index == * idx) ;
193+ . is_some_and ( |index| index == * idx) ;
194194 let full_text =
195195 trim_length_left ( & self . contents [ * idx] , width) ;
196196 let trim_length =
You can’t perform that action at this time.
0 commit comments