summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuan <tecedorroajuan@gmail.com>2024-03-07 20:08:28 +0100
committerGitHub <noreply@github.com>2024-03-07 20:08:28 +0100
commit43af49bab4b444ba9d584f5b48ce7fbe461ac184 (patch)
tree2bc8ae10b9ce36c7b9c2983840d761fb3b90c029 /src
parentf130cd50689177c8ba24bbd86551c4780a15c899 (diff)
Remove unused clippy warning suppression (missing_const_for_fn) (#2115)
Diffstat (limited to 'src')
-rw-r--r--src/components/commitlist.rs2
-rw-r--r--src/main.rs2
-rw-r--r--src/popups/blame_file.rs8
-rw-r--r--src/popups/log_search.rs2
-rw-r--r--src/tabs/revlog.rs4
-rw-r--r--src/ui/scrolllist.rs1
-rw-r--r--src/ui/stateful_paragraph.rs1
-rw-r--r--src/ui/style.rs6
8 files changed, 12 insertions, 14 deletions
diff --git a/src/components/commitlist.rs b/src/components/commitlist.rs
index 84f9c3ae..44fdb1e2 100644
--- a/src/components/commitlist.rs
+++ b/src/components/commitlist.rs
@@ -296,7 +296,6 @@ impl CommitList {
self.current_size.get()
}
- #[allow(clippy::missing_const_for_fn)]
fn selection_max(&self) -> usize {
self.commits.len().saturating_sub(1)
}
@@ -664,7 +663,6 @@ impl CommitList {
})
}
- #[allow(clippy::missing_const_for_fn)]
fn relative_selection(&self) -> usize {
self.selection.saturating_sub(self.items.index_offset())
}
diff --git a/src/main.rs b/src/main.rs
index 91d6649a..84a7a82e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,8 +21,6 @@
clippy::bool_to_int_with_if,
clippy::module_name_repetitions
)]
-// high number of false positives on nightly (as of Oct 2022 with 1.66.0-nightly)
-#![allow(clippy::missing_const_for_fn)]
//TODO:
// #![deny(clippy::expect_used)]
diff --git a/src/popups/blame_file.rs b/src/popups/blame_file.rs
index 62d1c748..65c7c202 100644
--- a/src/popups/blame_file.rs
+++ b/src/popups/blame_file.rs
@@ -45,11 +45,11 @@ impl SyntaxFileBlame {
&self.file_blame.path
}
- fn commit_id(&self) -> &CommitId {
+ const fn commit_id(&self) -> &CommitId {
&self.file_blame.commit_id
}
- fn lines(&self) -> &Vec<(Option<BlameHunk>, String)> {
+ const fn lines(&self) -> &Vec<(Option<BlameHunk>, String)> {
&self.file_blame.lines
}
}
@@ -64,7 +64,7 @@ enum BlameProcess {
}
impl BlameProcess {
- fn result(&self) -> Option<&SyntaxFileBlame> {
+ const fn result(&self) -> Option<&SyntaxFileBlame> {
match self {
Self::GettingBlame(_) => None,
Self::SyntaxHighlighting {
@@ -386,7 +386,7 @@ impl BlameFilePopup {
}
///
- pub fn any_work_pending(&self) -> bool {
+ pub const fn any_work_pending(&self) -> bool {
self.blame.is_some()
&& !matches!(self.blame, Some(BlameProcess::Result(_)))
}
diff --git a/src/popups/log_search.rs b/src/popups/log_search.rs
index 2513d7ec..e0c57b2c 100644
--- a/src/popups/log_search.rs
+++ b/src/popups/log_search.rs
@@ -267,7 +267,7 @@ impl LogSearchPopupPopup {
]
}
- fn option_selected(&self) -> bool {
+ const fn option_selected(&self) -> bool {
!matches!(self.selection, Selection::EnterText)
}
diff --git a/src/tabs/revlog.rs b/src/tabs/revlog.rs
index 524550dd..cf4f966b 100644
--- a/src/tabs/revlog.rs
+++ b/src/tabs/revlog.rs
@@ -342,7 +342,7 @@ impl Revlog {
}
}
- fn is_in_search_mode(&self) -> bool {
+ const fn is_in_search_mode(&self) -> bool {
!matches!(self.search, LogSearch::Off)
}
@@ -396,7 +396,7 @@ impl Revlog {
);
}
- fn can_close_search(&self) -> bool {
+ const fn can_close_search(&self) -> bool {
self.is_in_search_mode() && !self.is_search_pending()
}
diff --git a/src/ui/scrolllist.rs b/src/ui/scrolllist.rs
index 9d4f80a8..d9d369c9 100644
--- a/src/ui/scrolllist.rs
+++ b/src/ui/scrolllist.rs
@@ -34,7 +34,6 @@ where
}
}
- #[allow(clippy::missing_const_for_fn)]
fn block(mut self, block: Block<'b>) -> Self {
self.block = Some(block);
self
diff --git a/src/ui/stateful_paragraph.rs b/src/ui/stateful_paragraph.rs
index 4e31cb07..368c07b8 100644
--- a/src/ui/stateful_paragraph.rs
+++ b/src/ui/stateful_paragraph.rs
@@ -89,7 +89,6 @@ impl<'a> StatefulParagraph<'a> {
}
}
- #[allow(clippy::missing_const_for_fn)]
pub fn block(mut self, block: Block<'a>) -> Self {
self.block = Some(block);
self
diff --git a/src/ui/style.rs b/src/ui/style.rs
index c00137b7..e687e45e 100644
--- a/src/ui/style.rs
+++ b/src/ui/style.rs
@@ -143,7 +143,11 @@ impl Theme {
self.apply_select(style, selected)
}
- fn apply_select(&self, style: Style, selected: bool) -> Style {
+ const fn apply_select(
+ &self,
+ style: Style,
+ selected: bool,
+ ) -> Style {
if selected {
style.bg(self.selection_bg).fg(self.selection_fg)
} else {