Auto-fix clippy::collapsible_if violations (#36428)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 15:27:24 +02:00 committed by GitHub
parent 9e8ec72bd5
commit 8f567383e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
281 changed files with 6628 additions and 7089 deletions

View file

@ -135,11 +135,10 @@ impl CommitModal {
.as_ref()
.and_then(|repo| repo.read(cx).head_commit.as_ref())
.is_some()
&& !git_panel.amend_pending()
{
if !git_panel.amend_pending() {
git_panel.set_amend_pending(true, cx);
git_panel.load_last_commit_message_if_empty(cx);
}
git_panel.set_amend_pending(true, cx);
git_panel.load_last_commit_message_if_empty(cx);
}
}
ForceMode::Commit => {
@ -195,12 +194,12 @@ impl CommitModal {
let commit_message = commit_editor.read(cx).text(cx);
if let Some(suggested_commit_message) = suggested_commit_message {
if commit_message.is_empty() {
commit_editor.update(cx, |editor, cx| {
editor.set_placeholder_text(suggested_commit_message, cx);
});
}
if let Some(suggested_commit_message) = suggested_commit_message
&& commit_message.is_empty()
{
commit_editor.update(cx, |editor, cx| {
editor.set_placeholder_text(suggested_commit_message, cx);
});
}
let focus_handle = commit_editor.focus_handle(cx);

View file

@ -926,19 +926,17 @@ impl GitPanel {
let workspace = self.workspace.upgrade()?;
let git_repo = self.active_repository.as_ref()?;
if let Some(project_diff) = workspace.read(cx).active_item_as::<ProjectDiff>(cx) {
if let Some(project_path) = project_diff.read(cx).active_path(cx) {
if Some(&entry.repo_path)
== git_repo
.read(cx)
.project_path_to_repo_path(&project_path, cx)
.as_ref()
{
project_diff.focus_handle(cx).focus(window);
project_diff.update(cx, |project_diff, cx| project_diff.autoscroll(cx));
return None;
}
}
if let Some(project_diff) = workspace.read(cx).active_item_as::<ProjectDiff>(cx)
&& let Some(project_path) = project_diff.read(cx).active_path(cx)
&& Some(&entry.repo_path)
== git_repo
.read(cx)
.project_path_to_repo_path(&project_path, cx)
.as_ref()
{
project_diff.focus_handle(cx).focus(window);
project_diff.update(cx, |project_diff, cx| project_diff.autoscroll(cx));
return None;
};
self.workspace
@ -2514,10 +2512,11 @@ impl GitPanel {
new_co_authors.push((name.clone(), email.clone()))
}
}
if !project.is_local() && !project.is_read_only(cx) {
if let Some(local_committer) = self.local_committer(room, cx) {
new_co_authors.push(local_committer);
}
if !project.is_local()
&& !project.is_read_only(cx)
&& let Some(local_committer) = self.local_committer(room, cx)
{
new_co_authors.push(local_committer);
}
new_co_authors
}
@ -2758,14 +2757,13 @@ impl GitPanel {
pending_staged_count += pending.entries.len();
last_pending_staged = pending.entries.first().cloned();
}
if let Some(single_staged) = &single_staged_entry {
if pending
if let Some(single_staged) = &single_staged_entry
&& pending
.entries
.iter()
.any(|entry| entry.repo_path == single_staged.repo_path)
{
pending_status_for_single_staged = Some(pending.target_status);
}
{
pending_status_for_single_staged = Some(pending.target_status);
}
}

View file

@ -363,10 +363,10 @@ impl ProjectDiff {
}
_ => {}
}
if editor.focus_handle(cx).contains_focused(window, cx) {
if self.multibuffer.read(cx).is_empty() {
self.focus_handle.focus(window)
}
if editor.focus_handle(cx).contains_focused(window, cx)
&& self.multibuffer.read(cx).is_empty()
{
self.focus_handle.focus(window)
}
}