diff --git a/asyncgit/src/lib.rs b/asyncgit/src/lib.rs index e37ac2163f..8f2efa1527 100644 --- a/asyncgit/src/lib.rs +++ b/asyncgit/src/lib.rs @@ -10,6 +10,7 @@ It wraps libraries like git2 and gix. #![forbid(missing_docs)] #![deny( + mismatched_lifetime_syntaxes, unused_imports, unused_must_use, dead_code, diff --git a/asyncgit/src/sync/remotes/mod.rs b/asyncgit/src/sync/remotes/mod.rs index 8c3aaf32eb..6f1284f985 100644 --- a/asyncgit/src/sync/remotes/mod.rs +++ b/asyncgit/src/sync/remotes/mod.rs @@ -120,7 +120,7 @@ pub fn get_default_remote(repo_path: &RepoPath) -> Result { /// and Err if there was a problem finding the branch fn get_current_branch( repo: &Repository, -) -> Result> { +) -> Result>> { for b in repo.branches(None)? { let branch = b?.0; if branch.is_head() { diff --git a/asyncgit/src/sync/reword.rs b/asyncgit/src/sync/reword.rs index 8cae043451..a503686321 100644 --- a/asyncgit/src/sync/reword.rs +++ b/asyncgit/src/sync/reword.rs @@ -62,7 +62,7 @@ pub fn reword( /// and Err if there was a problem finding the branch fn get_current_branch( repo: &Repository, -) -> Result> { +) -> Result>> { for b in repo.branches(None)? { let branch = b?.0; if branch.is_head() { diff --git a/filetreelist/src/lib.rs b/filetreelist/src/lib.rs index 5504efb2bc..3e80065aba 100644 --- a/filetreelist/src/lib.rs +++ b/filetreelist/src/lib.rs @@ -1,6 +1,7 @@ // #![forbid(missing_docs)] #![forbid(unsafe_code)] #![deny( + mismatched_lifetime_syntaxes, unused_imports, unused_must_use, dead_code, diff --git a/git2-hooks/src/lib.rs b/git2-hooks/src/lib.rs index 4c949a1e46..95737f79ae 100644 --- a/git2-hooks/src/lib.rs +++ b/git2-hooks/src/lib.rs @@ -11,6 +11,7 @@ #![forbid(unsafe_code)] #![deny( + mismatched_lifetime_syntaxes, unused_imports, unused_must_use, dead_code, diff --git a/git2-testing/src/lib.rs b/git2-testing/src/lib.rs index e8ca87477d..40e1679041 100644 --- a/git2-testing/src/lib.rs +++ b/git2-testing/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(mismatched_lifetime_syntaxes)] + use git2::Repository; use tempfile::TempDir; diff --git a/invalidstring/src/lib.rs b/invalidstring/src/lib.rs index 175d81688c..b57f19139b 100644 --- a/invalidstring/src/lib.rs +++ b/invalidstring/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(mismatched_lifetime_syntaxes)] + /// uses unsafe to postfix the string with invalid utf8 data #[allow(invalid_from_utf8_unchecked)] pub fn invalid_utf8(prefix: &str) -> String { diff --git a/scopetime/src/lib.rs b/scopetime/src/lib.rs index 4d99702ad5..16394e1a64 100644 --- a/scopetime/src/lib.rs +++ b/scopetime/src/lib.rs @@ -1,7 +1,7 @@ //! simple macro to insert a scope based runtime measure that logs the result #![forbid(unsafe_code)] -#![deny(unused_imports)] +#![deny(mismatched_lifetime_syntaxes, unused_imports)] #![deny(clippy::unwrap_used)] #![deny(clippy::perf)] diff --git a/src/components/commit_details/compare_details.rs b/src/components/commit_details/compare_details.rs index 3438447c61..47e7a96823 100644 --- a/src/components/commit_details/compare_details.rs +++ b/src/components/commit_details/compare_details.rs @@ -58,7 +58,7 @@ impl CompareDetailsComponent { }); } - fn get_commit_text(&self, data: &CommitDetails) -> Vec { + fn get_commit_text(&self, data: &CommitDetails) -> Vec> { let mut res = vec![ Line::from(vec![ style_detail(&self.theme, &Detail::Author), diff --git a/src/components/commit_details/details.rs b/src/components/commit_details/details.rs index 95aa018ac5..86e7ab8c6a 100644 --- a/src/components/commit_details/details.rs +++ b/src/components/commit_details/details.rs @@ -136,7 +136,7 @@ impl DetailsComponent { &self, width: usize, height: usize, - ) -> Vec { + ) -> Vec> { let (wrapped_title, wrapped_message) = Self::get_wrapped_lines(self.data.as_ref(), width); @@ -156,7 +156,7 @@ impl DetailsComponent { } #[allow(clippy::too_many_lines)] - fn get_text_info(&self) -> Vec { + fn get_text_info(&self) -> Vec> { self.data.as_ref().map_or_else(Vec::new, |data| { let mut res = vec![ Line::from(vec![ diff --git a/src/components/commitlist.rs b/src/components/commitlist.rs index 06c48e751b..da1a342db8 100644 --- a/src/components/commitlist.rs +++ b/src/components/commitlist.rs @@ -565,7 +565,7 @@ impl CommitList { Line::from(txt) } - fn get_text(&self, height: usize, width: usize) -> Vec { + fn get_text(&self, height: usize, width: usize) -> Vec> { let selection = self.relative_selection(); let mut txt: Vec = Vec::with_capacity(height); diff --git a/src/components/diff.rs b/src/components/diff.rs index 2d2729ddea..2eb492db29 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -324,7 +324,7 @@ impl DiffComponent { None } - fn get_text(&self, width: u16, height: u16) -> Vec { + fn get_text(&self, width: u16, height: u16) -> Vec> { if let Some(diff) = &self.diff { return if diff.hunks.is_empty() { self.get_text_binary(diff) @@ -387,7 +387,7 @@ impl DiffComponent { vec![] } - fn get_text_binary(&self, diff: &FileDiff) -> Vec { + fn get_text_binary(&self, diff: &FileDiff) -> Vec> { let is_positive = diff.size_delta >= 0; let delta_byte_size = ByteSize::b(diff.size_delta.unsigned_abs()); diff --git a/src/components/status_tree.rs b/src/components/status_tree.rs index 1d5f39cb6f..0091cb7caa 100644 --- a/src/components/status_tree.rs +++ b/src/components/status_tree.rs @@ -223,7 +223,7 @@ impl StatusTreeComponent { /// allowing folders to be folded up if they are alone in their directory fn build_vec_text_draw_info_for_drawing( &self, - ) -> (Vec, usize, usize) { + ) -> (Vec>, usize, usize) { let mut should_skip_over: usize = 0; let mut selection_offset: usize = 0; let mut selection_offset_visible: usize = 0; diff --git a/src/main.rs b/src/main.rs index de1e6afce1..dbcce4e58f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,7 @@ #![forbid(unsafe_code)] #![deny( + mismatched_lifetime_syntaxes, unused_imports, unused_must_use, dead_code, diff --git a/src/popups/blame_file.rs b/src/popups/blame_file.rs index 9672965bcb..dd32bbc84c 100644 --- a/src/popups/blame_file.rs +++ b/src/popups/blame_file.rs @@ -529,7 +529,7 @@ impl BlameFilePopup { } /// - fn get_rows(&self, width: usize) -> Vec { + fn get_rows(&self, width: usize) -> Vec> { self.blame .as_ref() .and_then(|blame| blame.result()) @@ -643,7 +643,7 @@ impl BlameFilePopup { &self, width: usize, blame_hunk: Option<&BlameHunk>, - ) -> Vec { + ) -> Vec> { let commit_hash = blame_hunk.map_or_else( || NO_COMMIT_ID.into(), |hunk| hunk.commit_id.get_short_string(), diff --git a/src/popups/branchlist.rs b/src/popups/branchlist.rs index 2fe8690539..1478cdd9ed 100644 --- a/src/popups/branchlist.rs +++ b/src/popups/branchlist.rs @@ -473,7 +473,7 @@ impl BranchListPopup { theme: &SharedTheme, width_available: u16, height: usize, - ) -> Text { + ) -> Text<'_> { const UPSTREAM_SYMBOL: char = '\u{2191}'; const TRACKING_SYMBOL: char = '\u{2193}'; const HEAD_SYMBOL: char = '*'; diff --git a/src/popups/file_revlog.rs b/src/popups/file_revlog.rs index 3a923c5535..771ae857fe 100644 --- a/src/popups/file_revlog.rs +++ b/src/popups/file_revlog.rs @@ -263,7 +263,7 @@ impl FileRevlogPopup { ) } - fn get_rows(&self, now: DateTime) -> Vec { + fn get_rows(&self, now: DateTime) -> Vec> { self.items .iter() .map(|entry| { diff --git a/src/popups/help.rs b/src/popups/help.rs index 9e9b702e71..0ca3bb0e27 100644 --- a/src/popups/help.rs +++ b/src/popups/help.rs @@ -211,7 +211,7 @@ impl HelpPopup { } } - fn get_text(&self) -> Vec { + fn get_text(&self) -> Vec> { let mut txt: Vec = Vec::new(); let mut processed = 0_u16; diff --git a/src/popups/log_search.rs b/src/popups/log_search.rs index 46a37f0bbb..3cd6ad86b1 100644 --- a/src/popups/log_search.rs +++ b/src/popups/log_search.rs @@ -164,7 +164,7 @@ impl LogSearchPopupPopup { } } - fn get_text_options(&self) -> Vec { + fn get_text_options(&self) -> Vec> { let x_summary = if self.options.0.contains(SearchFields::MESSAGE_SUMMARY) { diff --git a/src/popups/options.rs b/src/popups/options.rs index e74e8bdc0b..4e194cb571 100644 --- a/src/popups/options.rs +++ b/src/popups/options.rs @@ -51,7 +51,7 @@ impl OptionsPopup { } } - fn get_text(&self, width: u16) -> Vec { + fn get_text(&self, width: u16) -> Vec> { let mut txt: Vec = Vec::with_capacity(10); self.add_status(&mut txt, width); diff --git a/src/popups/remotelist.rs b/src/popups/remotelist.rs index 409f44714d..c69923f5f5 100644 --- a/src/popups/remotelist.rs +++ b/src/popups/remotelist.rs @@ -230,7 +230,7 @@ impl RemoteListPopup { theme: &SharedTheme, width_available: u16, height: usize, - ) -> Text { + ) -> Text<'_> { const THREE_DOTS: &str = "..."; const THREE_DOTS_LENGTH: usize = THREE_DOTS.len(); // "..." diff --git a/src/popups/reset.rs b/src/popups/reset.rs index eb99d93ab8..e3c9865d56 100644 --- a/src/popups/reset.rs +++ b/src/popups/reset.rs @@ -67,7 +67,7 @@ impl ResetPopup { } } - fn get_text(&self, _width: u16) -> Vec { + fn get_text(&self, _width: u16) -> Vec> { let mut txt: Vec = Vec::with_capacity(10); txt.push(Line::from(vec![ diff --git a/src/popups/submodules.rs b/src/popups/submodules.rs index b73a9abe86..8fe3c23e56 100644 --- a/src/popups/submodules.rs +++ b/src/popups/submodules.rs @@ -336,7 +336,7 @@ impl SubmodulesListPopup { theme: &SharedTheme, width_available: u16, height: usize, - ) -> Text { + ) -> Text<'_> { const THREE_DOTS: &str = "..."; const THREE_DOTS_LENGTH: usize = THREE_DOTS.len(); // "..." const COMMIT_HASH_LENGTH: usize = 8; @@ -393,7 +393,7 @@ impl SubmodulesListPopup { Text::from(txt) } - fn get_info_text(&self, theme: &SharedTheme) -> Text { + fn get_info_text(&self, theme: &SharedTheme) -> Text<'_> { self.selected_entry().map_or_else( Text::default, |submodule| { @@ -442,7 +442,7 @@ impl SubmodulesListPopup { ) } - fn get_local_info_text(&self, theme: &SharedTheme) -> Text { + fn get_local_info_text(&self, theme: &SharedTheme) -> Text<'_> { let mut spans = vec![ Line::from(vec![Span::styled( "Current:", diff --git a/src/popups/taglist.rs b/src/popups/taglist.rs index 8acda78e89..69242b48e2 100644 --- a/src/popups/taglist.rs +++ b/src/popups/taglist.rs @@ -433,14 +433,14 @@ impl TagListPopup { } /// - fn get_rows(&self) -> Vec { + fn get_rows(&self) -> Vec> { self.tags.as_ref().map_or_else(Vec::new, |tags| { tags.iter().map(|tag| self.get_row(tag)).collect() }) } /// - fn get_row(&self, tag: &TagWithMetadata) -> Row { + fn get_row(&self, tag: &TagWithMetadata) -> Row<'_> { const UPSTREAM_SYMBOL: &str = "\u{2191}"; const ATTACHMENT_SYMBOL: &str = "@"; const EMPTY_SYMBOL: &str = " "; diff --git a/src/strings.rs b/src/strings.rs index c4cff10f70..0b2d25efe7 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -423,7 +423,7 @@ pub fn copy_success(s: &str) -> String { format!("{POPUP_SUCCESS_COPY} \"{s}\"") } -pub fn ellipsis_trim_start(s: &str, width: usize) -> Cow { +pub fn ellipsis_trim_start(s: &str, width: usize) -> Cow<'_, str> { if s.width() <= width { Cow::Borrowed(s) } else { diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index 5b2fe4b496..4f04e9ebc6 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -98,7 +98,7 @@ impl Stashing { Ok(()) } - fn get_option_text(&self) -> Vec { + fn get_option_text(&self) -> Vec> { let bracket_open = Span::raw(Cow::from("[")); let bracket_close = Span::raw(Cow::from("]")); let option_on =