fix: apply clippy suggestions from rust nightly
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 7m42s
Rust / build (map[name:stable]) (push) Successful in 10m55s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 2m15s
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful

This commit is contained in:
Paul Campbell 2024-11-21 21:55:45 +00:00
parent 614e721b91
commit bf6b4fcd21
7 changed files with 17 additions and 17 deletions

View file

@ -15,7 +15,7 @@ use super::{forge::ForgeWidget, HeightContraintLength};
pub struct ConfiguredAppWidget<'a> { pub struct ConfiguredAppWidget<'a> {
pub forges: &'a BTreeMap<ForgeAlias, ForgeState>, pub forges: &'a BTreeMap<ForgeAlias, ForgeState>,
} }
impl<'a> HeightContraintLength for ConfiguredAppWidget<'a> { impl HeightContraintLength for ConfiguredAppWidget<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
self.children() self.children()
.iter() .iter()
@ -24,7 +24,7 @@ impl<'a> HeightContraintLength for ConfiguredAppWidget<'a> {
+ 2 // top + bottom borders + 2 // top + bottom borders
} }
} }
impl<'a> StatefulWidget for ConfiguredAppWidget<'a> { impl StatefulWidget for ConfiguredAppWidget<'_> {
type State = ScrollViewState; type State = ScrollViewState;
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State)

View file

@ -7,12 +7,12 @@ use crate::tui::components::HeightContraintLength;
pub struct CollapsedForgeWidget<'a> { pub struct CollapsedForgeWidget<'a> {
pub forge_alias: &'a ForgeAlias, pub forge_alias: &'a ForgeAlias,
} }
impl<'a> HeightContraintLength for CollapsedForgeWidget<'a> { impl HeightContraintLength for CollapsedForgeWidget<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
1 1
} }
} }
impl<'a> Widget for CollapsedForgeWidget<'a> { impl Widget for CollapsedForgeWidget<'_> {
fn render(self, area: Rect, buf: &mut Buffer) fn render(self, area: Rect, buf: &mut Buffer)
where where
Self: Sized, Self: Sized,

View file

@ -18,7 +18,7 @@ pub struct ExpandedForgeWidget<'a> {
pub forge_alias: &'a ForgeAlias, pub forge_alias: &'a ForgeAlias,
pub repos: &'a BTreeMap<RepoAlias, RepoState>, pub repos: &'a BTreeMap<RepoAlias, RepoState>,
} }
impl<'a> HeightContraintLength for ExpandedForgeWidget<'a> { impl HeightContraintLength for ExpandedForgeWidget<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
self.children() self.children()
.iter() .iter()
@ -27,7 +27,7 @@ impl<'a> HeightContraintLength for ExpandedForgeWidget<'a> {
+ 2 // top title + bottom padding + 2 // top title + bottom padding
} }
} }
impl<'a> Widget for ExpandedForgeWidget<'a> { impl Widget for ExpandedForgeWidget<'_> {
fn render(self, area: Rect, buf: &mut Buffer) fn render(self, area: Rect, buf: &mut Buffer)
where where
Self: Sized, Self: Sized,

View file

@ -18,7 +18,7 @@ pub struct ForgeWidget<'a> {
pub repos: &'a BTreeMap<RepoAlias, RepoState>, pub repos: &'a BTreeMap<RepoAlias, RepoState>,
pub view_state: ViewState, pub view_state: ViewState,
} }
impl<'a> HeightContraintLength for ForgeWidget<'a> { impl HeightContraintLength for ForgeWidget<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
match self.view_state { match self.view_state {
ViewState::Collapsed => CollapsedForgeWidget { 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) fn render(self, area: Rect, buf: &mut Buffer)
where where
Self: Sized, Self: Sized,

View file

@ -12,12 +12,12 @@ use super::HeightContraintLength;
pub struct CommitLog<'a> { pub struct CommitLog<'a> {
pub log: &'a Log, pub log: &'a Log,
} }
impl<'a> HeightContraintLength for CommitLog<'a> { impl HeightContraintLength for CommitLog<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
u16::try_from(self.log.len()).unwrap_or(u16::MAX) 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) fn render(self, area: ratatui::prelude::Rect, buf: &mut ratatui::prelude::Buffer)
where where
Self: Sized, Self: Sized,

View file

@ -26,12 +26,12 @@ use super::HeightContraintLength;
pub struct RepoWidget<'a> { pub struct RepoWidget<'a> {
pub repo_state: &'a RepoState, pub repo_state: &'a RepoState,
} }
impl<'a> HeightContraintLength for RepoWidget<'a> { impl HeightContraintLength for RepoWidget<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
self.inner().height_constraint_length() + 2 // top + bottom borders self.inner().height_constraint_length() + 2 // top + bottom borders
} }
} }
impl<'a> RepoWidget<'a> { impl RepoWidget<'_> {
fn inner(&self) -> InnerRepoWidget { fn inner(&self) -> InnerRepoWidget {
match self.repo_state { match self.repo_state {
RepoState::Identified { 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) fn render(self, area: Rect, buf: &mut Buffer)
where where
Self: Sized, Self: Sized,
@ -86,14 +86,14 @@ struct InnerRepoWidget<'a> {
pub branches: Option<&'a RepoBranches>, pub branches: Option<&'a RepoBranches>,
pub log: Option<&'a git::graph::Log>, pub log: Option<&'a git::graph::Log>,
} }
impl<'a> HeightContraintLength for InnerRepoWidget<'a> { impl HeightContraintLength for InnerRepoWidget<'_> {
fn height_constraint_length(&self) -> u16 { fn height_constraint_length(&self) -> u16 {
self.log self.log
.map(|log| CommitLog { log }) .map(|log| CommitLog { log })
.map_or(0, |w| w.height_constraint_length()) .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) fn render(self, area: Rect, buf: &mut Buffer)
where where
Self: Sized, Self: Sized,

View file

@ -13,10 +13,10 @@ pub fn validate_default_remotes(
) -> Result<()> { ) -> Result<()> {
let push_remote = open_repository let push_remote = open_repository
.find_default_remote(git::repository::Direction::Push) .find_default_remote(git::repository::Direction::Push)
.ok_or_else(|| Error::NoDefaultPushRemote)?; .ok_or(Error::NoDefaultPushRemote)?;
let fetch_remote = open_repository let fetch_remote = open_repository
.find_default_remote(git::repository::Direction::Fetch) .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 { let Some(remote_url) = repo_details.remote_url() else {
return Err(git::validation::remotes::Error::UnableToOpenRepo( return Err(git::validation::remotes::Error::UnableToOpenRepo(
"Unable to build forge url".to_string(), "Unable to build forge url".to_string(),