File tree Expand file tree Collapse file tree 11 files changed +16
-18
lines changed Expand file tree Collapse file tree 11 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## Unreleased
9
9
10
+ ### Changed
11
+
12
+ * re-enable clippy ` missing_const_for_fn ` linter warning and added const to functions where applicable ([ #2116 ] ( https://github.com/extrawurst/gitui/issues/2116 ) )
13
+
10
14
## [ 0.25.1] - 2024-02-23
11
15
12
16
### Fixes
Original file line number Diff line number Diff line change @@ -82,8 +82,6 @@ pub struct CommitDetails {
82
82
83
83
impl CommitDetails {
84
84
///
85
- #[ allow( clippy:: missing_const_for_fn) ]
86
- // clippy doesn't realise indexing a String is not const
87
85
pub fn short_hash ( & self ) -> & str {
88
86
& self . hash [ 0 ..7 ]
89
87
}
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ pub struct Tag {
20
20
21
21
impl Tag {
22
22
///
23
- #[ allow( clippy:: missing_const_for_fn) ]
24
- // clippy doesn't realise allocating a String is not const
25
23
pub fn new ( name : & str ) -> Self {
26
24
Self {
27
25
name : name. into ( ) ,
Original file line number Diff line number Diff line change @@ -296,7 +296,6 @@ impl CommitList {
296
296
self . current_size . get ( )
297
297
}
298
298
299
- #[ allow( clippy:: missing_const_for_fn) ]
300
299
fn selection_max ( & self ) -> usize {
301
300
self . commits . len ( ) . saturating_sub ( 1 )
302
301
}
@@ -664,7 +663,6 @@ impl CommitList {
664
663
} )
665
664
}
666
665
667
- #[ allow( clippy:: missing_const_for_fn) ]
668
666
fn relative_selection ( & self ) -> usize {
669
667
self . selection . saturating_sub ( self . items . index_offset ( ) )
670
668
}
Original file line number Diff line number Diff line change 21
21
clippy:: bool_to_int_with_if,
22
22
clippy:: module_name_repetitions
23
23
) ]
24
- // high number of false positives on nightly (as of Oct 2022 with 1.66.0-nightly)
25
- #![ allow( clippy:: missing_const_for_fn) ]
26
24
27
25
//TODO:
28
26
// #![deny(clippy::expect_used)]
Original file line number Diff line number Diff line change @@ -45,11 +45,11 @@ impl SyntaxFileBlame {
45
45
& self . file_blame . path
46
46
}
47
47
48
- fn commit_id ( & self ) -> & CommitId {
48
+ const fn commit_id ( & self ) -> & CommitId {
49
49
& self . file_blame . commit_id
50
50
}
51
51
52
- fn lines ( & self ) -> & Vec < ( Option < BlameHunk > , String ) > {
52
+ const fn lines ( & self ) -> & Vec < ( Option < BlameHunk > , String ) > {
53
53
& self . file_blame . lines
54
54
}
55
55
}
@@ -64,7 +64,7 @@ enum BlameProcess {
64
64
}
65
65
66
66
impl BlameProcess {
67
- fn result ( & self ) -> Option < & SyntaxFileBlame > {
67
+ const fn result ( & self ) -> Option < & SyntaxFileBlame > {
68
68
match self {
69
69
Self :: GettingBlame ( _) => None ,
70
70
Self :: SyntaxHighlighting {
@@ -386,7 +386,7 @@ impl BlameFilePopup {
386
386
}
387
387
388
388
///
389
- pub fn any_work_pending ( & self ) -> bool {
389
+ pub const fn any_work_pending ( & self ) -> bool {
390
390
self . blame . is_some ( )
391
391
&& !matches ! ( self . blame, Some ( BlameProcess :: Result ( _) ) )
392
392
}
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ impl LogSearchPopupPopup {
267
267
]
268
268
}
269
269
270
- fn option_selected ( & self ) -> bool {
270
+ const fn option_selected ( & self ) -> bool {
271
271
!matches ! ( self . selection, Selection :: EnterText )
272
272
}
273
273
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ impl Revlog {
342
342
}
343
343
}
344
344
345
- fn is_in_search_mode ( & self ) -> bool {
345
+ const fn is_in_search_mode ( & self ) -> bool {
346
346
!matches ! ( self . search, LogSearch :: Off )
347
347
}
348
348
@@ -396,7 +396,7 @@ impl Revlog {
396
396
) ;
397
397
}
398
398
399
- fn can_close_search ( & self ) -> bool {
399
+ const fn can_close_search ( & self ) -> bool {
400
400
self . is_in_search_mode ( ) && !self . is_search_pending ( )
401
401
}
402
402
Original file line number Diff line number Diff line change 34
34
}
35
35
}
36
36
37
- #[ allow( clippy:: missing_const_for_fn) ]
38
37
fn block ( mut self , block : Block < ' b > ) -> Self {
39
38
self . block = Some ( block) ;
40
39
self
Original file line number Diff line number Diff line change @@ -89,7 +89,6 @@ impl<'a> StatefulParagraph<'a> {
89
89
}
90
90
}
91
91
92
- #[ allow( clippy:: missing_const_for_fn) ]
93
92
pub fn block ( mut self , block : Block < ' a > ) -> Self {
94
93
self . block = Some ( block) ;
95
94
self
You can’t perform that action at this time.
0 commit comments