mirror of
https://github.com/gitui-org/gitui
synced 2026-05-22 16:38:28 +00:00
Fix all mismatched_lifetime_syntaxes warnings (#2727)
This commit is contained in:
parent
5f23781c10
commit
26a38183cf
26 changed files with 34 additions and 26 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ pub fn get_default_remote(repo_path: &RepoPath) -> Result<String> {
|
|||
/// and Err if there was a problem finding the branch
|
||||
fn get_current_branch(
|
||||
repo: &Repository,
|
||||
) -> Result<Option<git2::Branch>> {
|
||||
) -> Result<Option<git2::Branch<'_>>> {
|
||||
for b in repo.branches(None)? {
|
||||
let branch = b?.0;
|
||||
if branch.is_head() {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ pub fn reword(
|
|||
/// and Err if there was a problem finding the branch
|
||||
fn get_current_branch(
|
||||
repo: &Repository,
|
||||
) -> Result<Option<git2::Branch>> {
|
||||
) -> Result<Option<git2::Branch<'_>>> {
|
||||
for b in repo.branches(None)? {
|
||||
let branch = b?.0;
|
||||
if branch.is_head() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// #![forbid(missing_docs)]
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(
|
||||
mismatched_lifetime_syntaxes,
|
||||
unused_imports,
|
||||
unused_must_use,
|
||||
dead_code,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(
|
||||
mismatched_lifetime_syntaxes,
|
||||
unused_imports,
|
||||
unused_must_use,
|
||||
dead_code,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![deny(mismatched_lifetime_syntaxes)]
|
||||
|
||||
use git2::Repository;
|
||||
use tempfile::TempDir;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ impl CompareDetailsComponent {
|
|||
});
|
||||
}
|
||||
|
||||
fn get_commit_text(&self, data: &CommitDetails) -> Vec<Line> {
|
||||
fn get_commit_text(&self, data: &CommitDetails) -> Vec<Line<'_>> {
|
||||
let mut res = vec![
|
||||
Line::from(vec![
|
||||
style_detail(&self.theme, &Detail::Author),
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ impl DetailsComponent {
|
|||
&self,
|
||||
width: usize,
|
||||
height: usize,
|
||||
) -> Vec<Line> {
|
||||
) -> Vec<Line<'_>> {
|
||||
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<Line> {
|
||||
fn get_text_info(&self) -> Vec<Line<'_>> {
|
||||
self.data.as_ref().map_or_else(Vec::new, |data| {
|
||||
let mut res = vec![
|
||||
Line::from(vec![
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ impl CommitList {
|
|||
Line::from(txt)
|
||||
}
|
||||
|
||||
fn get_text(&self, height: usize, width: usize) -> Vec<Line> {
|
||||
fn get_text(&self, height: usize, width: usize) -> Vec<Line<'_>> {
|
||||
let selection = self.relative_selection();
|
||||
|
||||
let mut txt: Vec<Line> = Vec::with_capacity(height);
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ impl DiffComponent {
|
|||
None
|
||||
}
|
||||
|
||||
fn get_text(&self, width: u16, height: u16) -> Vec<Line> {
|
||||
fn get_text(&self, width: u16, height: u16) -> Vec<Line<'_>> {
|
||||
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<Line> {
|
||||
fn get_text_binary(&self, diff: &FileDiff) -> Vec<Line<'_>> {
|
||||
let is_positive = diff.size_delta >= 0;
|
||||
let delta_byte_size =
|
||||
ByteSize::b(diff.size_delta.unsigned_abs());
|
||||
|
|
|
|||
|
|
@ -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<TextDrawInfo>, usize, usize) {
|
||||
) -> (Vec<TextDrawInfo<'_>>, usize, usize) {
|
||||
let mut should_skip_over: usize = 0;
|
||||
let mut selection_offset: usize = 0;
|
||||
let mut selection_offset_visible: usize = 0;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(
|
||||
mismatched_lifetime_syntaxes,
|
||||
unused_imports,
|
||||
unused_must_use,
|
||||
dead_code,
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ impl BlameFilePopup {
|
|||
}
|
||||
|
||||
///
|
||||
fn get_rows(&self, width: usize) -> Vec<Row> {
|
||||
fn get_rows(&self, width: usize) -> Vec<Row<'_>> {
|
||||
self.blame
|
||||
.as_ref()
|
||||
.and_then(|blame| blame.result())
|
||||
|
|
@ -643,7 +643,7 @@ impl BlameFilePopup {
|
|||
&self,
|
||||
width: usize,
|
||||
blame_hunk: Option<&BlameHunk>,
|
||||
) -> Vec<Cell> {
|
||||
) -> Vec<Cell<'_>> {
|
||||
let commit_hash = blame_hunk.map_or_else(
|
||||
|| NO_COMMIT_ID.into(),
|
||||
|hunk| hunk.commit_id.get_short_string(),
|
||||
|
|
|
|||
|
|
@ -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 = '*';
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ impl FileRevlogPopup {
|
|||
)
|
||||
}
|
||||
|
||||
fn get_rows(&self, now: DateTime<Local>) -> Vec<Row> {
|
||||
fn get_rows(&self, now: DateTime<Local>) -> Vec<Row<'_>> {
|
||||
self.items
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ impl HelpPopup {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_text(&self) -> Vec<Line> {
|
||||
fn get_text(&self) -> Vec<Line<'_>> {
|
||||
let mut txt: Vec<Line> = Vec::new();
|
||||
|
||||
let mut processed = 0_u16;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ impl LogSearchPopupPopup {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_text_options(&self) -> Vec<Line> {
|
||||
fn get_text_options(&self) -> Vec<Line<'_>> {
|
||||
let x_summary =
|
||||
if self.options.0.contains(SearchFields::MESSAGE_SUMMARY)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl OptionsPopup {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_text(&self, width: u16) -> Vec<Line> {
|
||||
fn get_text(&self, width: u16) -> Vec<Line<'_>> {
|
||||
let mut txt: Vec<Line> = Vec::with_capacity(10);
|
||||
|
||||
self.add_status(&mut txt, width);
|
||||
|
|
|
|||
|
|
@ -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(); // "..."
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ impl ResetPopup {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_text(&self, _width: u16) -> Vec<Line> {
|
||||
fn get_text(&self, _width: u16) -> Vec<Line<'_>> {
|
||||
let mut txt: Vec<Line> = Vec::with_capacity(10);
|
||||
|
||||
txt.push(Line::from(vec![
|
||||
|
|
|
|||
|
|
@ -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:",
|
||||
|
|
|
|||
|
|
@ -433,14 +433,14 @@ impl TagListPopup {
|
|||
}
|
||||
|
||||
///
|
||||
fn get_rows(&self) -> Vec<Row> {
|
||||
fn get_rows(&self) -> Vec<Row<'_>> {
|
||||
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 = " ";
|
||||
|
|
|
|||
|
|
@ -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<str> {
|
||||
pub fn ellipsis_trim_start(s: &str, width: usize) -> Cow<'_, str> {
|
||||
if s.width() <= width {
|
||||
Cow::Borrowed(s)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ impl Stashing {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn get_option_text(&self) -> Vec<Line> {
|
||||
fn get_option_text(&self) -> Vec<Line<'_>> {
|
||||
let bracket_open = Span::raw(Cow::from("["));
|
||||
let bracket_close = Span::raw(Cow::from("]"));
|
||||
let option_on =
|
||||
|
|
|
|||
Loading…
Reference in a new issue