From 848623305303031c14c770dff93e57bda829f43c Mon Sep 17 00:00:00 2001 From: Alessandro Menezes Date: Sat, 9 Oct 2021 18:25:43 -0400 Subject: [PATCH] Fixing the CI Pipeline Rust nightly (1.57.0-nightly) was throwing errors when running `cargo clippy`. --- src/components/blame_file.rs | 6 ++---- src/components/branchlist.rs | 6 ++---- src/components/compare_commits.rs | 4 ++-- src/components/inspect_commit.rs | 4 ++-- src/components/pull.rs | 16 +++++++--------- src/components/push.rs | 6 ++---- src/components/push_tags.rs | 6 ++---- src/tabs/stashing.rs | 8 +++----- src/ui/stateful_paragraph.rs | 2 +- 9 files changed, 23 insertions(+), 35 deletions(-) diff --git a/src/components/blame_file.rs b/src/components/blame_file.rs index 8f12e95f..f7a5341e 100644 --- a/src/components/blame_file.rs +++ b/src/components/blame_file.rs @@ -286,10 +286,8 @@ impl BlameFileComponent { &mut self, event: AsyncGitNotification, ) -> Result<()> { - if self.is_visible() { - if let AsyncGitNotification::Blame = event { - self.update()?; - } + if self.is_visible() && event == AsyncGitNotification::Blame { + self.update()?; } Ok(()) diff --git a/src/components/branchlist.rs b/src/components/branchlist.rs index 7360268e..34c7255b 100644 --- a/src/components/branchlist.rs +++ b/src/components/branchlist.rs @@ -350,10 +350,8 @@ impl BranchListComponent { &mut self, ev: AsyncGitNotification, ) -> Result<()> { - if self.is_visible() { - if let AsyncGitNotification::Push = ev { - self.update_branches()?; - } + if self.is_visible() && ev == AsyncGitNotification::Push { + self.update_branches()?; } Ok(()) diff --git a/src/components/compare_commits.rs b/src/components/compare_commits.rs index fdc0b89b..908173ac 100644 --- a/src/components/compare_commits.rs +++ b/src/components/compare_commits.rs @@ -209,9 +209,9 @@ impl CompareCommitsComponent { ev: AsyncGitNotification, ) -> Result<()> { if self.is_visible() { - if let AsyncGitNotification::CommitFiles = ev { + if ev == AsyncGitNotification::CommitFiles { self.update()?; - } else if let AsyncGitNotification::Diff = ev { + } else if ev == AsyncGitNotification::Diff { self.update_diff()?; } } diff --git a/src/components/inspect_commit.rs b/src/components/inspect_commit.rs index 44bafa42..e7748aa7 100644 --- a/src/components/inspect_commit.rs +++ b/src/components/inspect_commit.rs @@ -227,9 +227,9 @@ impl InspectCommitComponent { ev: AsyncGitNotification, ) -> Result<()> { if self.is_visible() { - if let AsyncGitNotification::CommitFiles = ev { + if ev == AsyncGitNotification::CommitFiles { self.update()?; - } else if let AsyncGitNotification::Diff = ev { + } else if ev == AsyncGitNotification::Diff { self.update_diff()?; } } diff --git a/src/components/pull.rs b/src/components/pull.rs index 05d4c84f..7e807e01 100644 --- a/src/components/pull.rs +++ b/src/components/pull.rs @@ -111,15 +111,13 @@ impl PullComponent { /// pub fn update_git(&mut self, ev: AsyncGitNotification) { - if self.is_visible() { - if let AsyncGitNotification::Fetch = ev { - if let Err(error) = self.update() { - self.pending = false; - self.hide(); - self.queue.push(InternalEvent::ShowErrorMsg( - format!("fetch failed:\n{}", error), - )); - } + if self.is_visible() && ev == AsyncGitNotification::Fetch { + if let Err(error) = self.update() { + self.pending = false; + self.hide(); + self.queue.push(InternalEvent::ShowErrorMsg( + format!("fetch failed:\n{}", error), + )); } } } diff --git a/src/components/push.rs b/src/components/push.rs index 0dfe3a85..e0fc39dd 100644 --- a/src/components/push.rs +++ b/src/components/push.rs @@ -158,10 +158,8 @@ impl PushComponent { &mut self, ev: AsyncGitNotification, ) -> Result<()> { - if self.is_visible() { - if let AsyncGitNotification::Push = ev { - self.update()?; - } + if self.is_visible() && ev == AsyncGitNotification::Push { + self.update()?; } Ok(()) diff --git a/src/components/push_tags.rs b/src/components/push_tags.rs index 5bf8aa71..5e668644 100644 --- a/src/components/push_tags.rs +++ b/src/components/push_tags.rs @@ -101,10 +101,8 @@ impl PushTagsComponent { &mut self, ev: AsyncGitNotification, ) -> Result<()> { - if self.is_visible() { - if let AsyncGitNotification::PushTags = ev { - self.update()?; - } + if self.is_visible() && ev == AsyncGitNotification::PushTags { + self.update()?; } Ok(()) diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index dde72c88..ff05696b 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -91,11 +91,9 @@ impl Stashing { &mut self, ev: AsyncGitNotification, ) -> Result<()> { - if self.is_visible() { - if let AsyncGitNotification::Status = ev { - let status = self.git_status.last()?; - self.index.update(&status.items)?; - } + if self.is_visible() && ev == AsyncGitNotification::Status { + let status = self.git_status.last()?; + self.index.update(&status.items)?; } Ok(()) diff --git a/src/ui/stateful_paragraph.rs b/src/ui/stateful_paragraph.rs index 30615162..21bcad14 100644 --- a/src/ui/stateful_paragraph.rs +++ b/src/ui/stateful_paragraph.rs @@ -160,7 +160,7 @@ impl<'a> StatefulWidget for StatefulParagraph<'a> { &mut styled, text_area.width, )); - if let Alignment::Left = self.alignment { + if self.alignment == Alignment::Left { line_composer .set_horizontal_offset(state.scroll.x); }