From bf6b4fcd2135b83da0119ab6c5b1d93837bb73f7 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 21 Nov 2024 21:55:45 +0000 Subject: [PATCH] fix: apply clippy suggestions from rust nightly --- crates/cli/src/tui/components/configured_app.rs | 4 ++-- crates/cli/src/tui/components/forge/collapsed.rs | 4 ++-- crates/cli/src/tui/components/forge/expanded.rs | 4 ++-- crates/cli/src/tui/components/forge/mod.rs | 4 ++-- crates/cli/src/tui/components/history.rs | 4 ++-- crates/cli/src/tui/components/repo/mod.rs | 10 +++++----- crates/core/src/git/validation/remotes.rs | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/cli/src/tui/components/configured_app.rs b/crates/cli/src/tui/components/configured_app.rs index 114a1618..64b3f8d5 100644 --- a/crates/cli/src/tui/components/configured_app.rs +++ b/crates/cli/src/tui/components/configured_app.rs @@ -15,7 +15,7 @@ use super::{forge::ForgeWidget, HeightContraintLength}; pub struct ConfiguredAppWidget<'a> { pub forges: &'a BTreeMap, } -impl<'a> HeightContraintLength for ConfiguredAppWidget<'a> { +impl HeightContraintLength for ConfiguredAppWidget<'_> { fn height_constraint_length(&self) -> u16 { self.children() .iter() @@ -24,7 +24,7 @@ impl<'a> HeightContraintLength for ConfiguredAppWidget<'a> { + 2 // top + bottom borders } } -impl<'a> StatefulWidget for ConfiguredAppWidget<'a> { +impl StatefulWidget for ConfiguredAppWidget<'_> { type State = ScrollViewState; fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) diff --git a/crates/cli/src/tui/components/forge/collapsed.rs b/crates/cli/src/tui/components/forge/collapsed.rs index 3245efca..707054fd 100644 --- a/crates/cli/src/tui/components/forge/collapsed.rs +++ b/crates/cli/src/tui/components/forge/collapsed.rs @@ -7,12 +7,12 @@ use crate::tui::components::HeightContraintLength; pub struct CollapsedForgeWidget<'a> { pub forge_alias: &'a ForgeAlias, } -impl<'a> HeightContraintLength for CollapsedForgeWidget<'a> { +impl HeightContraintLength for CollapsedForgeWidget<'_> { fn height_constraint_length(&self) -> u16 { 1 } } -impl<'a> Widget for CollapsedForgeWidget<'a> { +impl Widget for CollapsedForgeWidget<'_> { fn render(self, area: Rect, buf: &mut Buffer) where Self: Sized, diff --git a/crates/cli/src/tui/components/forge/expanded.rs b/crates/cli/src/tui/components/forge/expanded.rs index 2d52d41a..347215e2 100644 --- a/crates/cli/src/tui/components/forge/expanded.rs +++ b/crates/cli/src/tui/components/forge/expanded.rs @@ -18,7 +18,7 @@ pub struct ExpandedForgeWidget<'a> { pub forge_alias: &'a ForgeAlias, pub repos: &'a BTreeMap, } -impl<'a> HeightContraintLength for ExpandedForgeWidget<'a> { +impl HeightContraintLength for ExpandedForgeWidget<'_> { fn height_constraint_length(&self) -> u16 { self.children() .iter() @@ -27,7 +27,7 @@ impl<'a> HeightContraintLength for ExpandedForgeWidget<'a> { + 2 // top title + bottom padding } } -impl<'a> Widget for ExpandedForgeWidget<'a> { +impl Widget for ExpandedForgeWidget<'_> { fn render(self, area: Rect, buf: &mut Buffer) where Self: Sized, diff --git a/crates/cli/src/tui/components/forge/mod.rs b/crates/cli/src/tui/components/forge/mod.rs index afce0e86..0bc9afc4 100644 --- a/crates/cli/src/tui/components/forge/mod.rs +++ b/crates/cli/src/tui/components/forge/mod.rs @@ -18,7 +18,7 @@ pub struct ForgeWidget<'a> { pub repos: &'a BTreeMap, pub view_state: ViewState, } -impl<'a> HeightContraintLength for ForgeWidget<'a> { +impl HeightContraintLength for ForgeWidget<'_> { fn height_constraint_length(&self) -> u16 { match self.view_state { ViewState::Collapsed => CollapsedForgeWidget { @@ -33,7 +33,7 @@ impl<'a> HeightContraintLength for ForgeWidget<'a> { } } } -impl<'a> Widget for ForgeWidget<'a> { +impl Widget for ForgeWidget<'_> { fn render(self, area: Rect, buf: &mut Buffer) where Self: Sized, diff --git a/crates/cli/src/tui/components/history.rs b/crates/cli/src/tui/components/history.rs index f18f270f..386d8d9d 100644 --- a/crates/cli/src/tui/components/history.rs +++ b/crates/cli/src/tui/components/history.rs @@ -12,12 +12,12 @@ use super::HeightContraintLength; pub struct CommitLog<'a> { pub log: &'a Log, } -impl<'a> HeightContraintLength for CommitLog<'a> { +impl HeightContraintLength for CommitLog<'_> { fn height_constraint_length(&self) -> u16 { u16::try_from(self.log.len()).unwrap_or(u16::MAX) } } -impl<'a> Widget for CommitLog<'a> { +impl Widget for CommitLog<'_> { fn render(self, area: ratatui::prelude::Rect, buf: &mut ratatui::prelude::Buffer) where Self: Sized, diff --git a/crates/cli/src/tui/components/repo/mod.rs b/crates/cli/src/tui/components/repo/mod.rs index 349dc1d1..5eacd0af 100644 --- a/crates/cli/src/tui/components/repo/mod.rs +++ b/crates/cli/src/tui/components/repo/mod.rs @@ -26,12 +26,12 @@ use super::HeightContraintLength; pub struct RepoWidget<'a> { pub repo_state: &'a RepoState, } -impl<'a> HeightContraintLength for RepoWidget<'a> { +impl HeightContraintLength for RepoWidget<'_> { fn height_constraint_length(&self) -> u16 { self.inner().height_constraint_length() + 2 // top + bottom borders } } -impl<'a> RepoWidget<'a> { +impl RepoWidget<'_> { fn inner(&self) -> InnerRepoWidget { match self.repo_state { RepoState::Identified { @@ -70,7 +70,7 @@ impl<'a> RepoWidget<'a> { } } } -impl<'a> Widget for RepoWidget<'a> { +impl Widget for RepoWidget<'_> { fn render(self, area: Rect, buf: &mut Buffer) where Self: Sized, @@ -86,14 +86,14 @@ struct InnerRepoWidget<'a> { pub branches: Option<&'a RepoBranches>, pub log: Option<&'a git::graph::Log>, } -impl<'a> HeightContraintLength for InnerRepoWidget<'a> { +impl HeightContraintLength for InnerRepoWidget<'_> { fn height_constraint_length(&self) -> u16 { self.log .map(|log| CommitLog { log }) .map_or(0, |w| w.height_constraint_length()) } } -impl<'a> Widget for InnerRepoWidget<'a> { +impl Widget for InnerRepoWidget<'_> { fn render(self, area: Rect, buf: &mut Buffer) where Self: Sized, diff --git a/crates/core/src/git/validation/remotes.rs b/crates/core/src/git/validation/remotes.rs index 66f2e2c5..2b5fa20f 100644 --- a/crates/core/src/git/validation/remotes.rs +++ b/crates/core/src/git/validation/remotes.rs @@ -13,10 +13,10 @@ pub fn validate_default_remotes( ) -> Result<()> { let push_remote = open_repository .find_default_remote(git::repository::Direction::Push) - .ok_or_else(|| Error::NoDefaultPushRemote)?; + .ok_or(Error::NoDefaultPushRemote)?; let fetch_remote = open_repository .find_default_remote(git::repository::Direction::Fetch) - .ok_or_else(|| Error::NoDefaultFetchRemote)?; + .ok_or(Error::NoDefaultFetchRemote)?; let Some(remote_url) = repo_details.remote_url() else { return Err(git::validation::remotes::Error::UnableToOpenRepo( "Unable to build forge url".to_string(),