forked from kemitix/git-next
fix: apply clippy suggestions from rust nightly
This commit is contained in:
parent
614e721b91
commit
bf6b4fcd21
7 changed files with 17 additions and 17 deletions
|
@ -15,7 +15,7 @@ use super::{forge::ForgeWidget, HeightContraintLength};
|
|||
pub struct ConfiguredAppWidget<'a> {
|
||||
pub forges: &'a BTreeMap<ForgeAlias, ForgeState>,
|
||||
}
|
||||
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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -18,7 +18,7 @@ pub struct ExpandedForgeWidget<'a> {
|
|||
pub forge_alias: &'a ForgeAlias,
|
||||
pub repos: &'a BTreeMap<RepoAlias, RepoState>,
|
||||
}
|
||||
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,
|
||||
|
|
|
@ -18,7 +18,7 @@ pub struct ForgeWidget<'a> {
|
|||
pub repos: &'a BTreeMap<RepoAlias, RepoState>,
|
||||
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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue