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

@ -1054,27 +1054,25 @@ fn quit(_: &Quit, cx: &mut App) {
})
.log_err();
if should_confirm {
if let Some(workspace) = workspace_windows.first() {
let answer = workspace
.update(cx, |_, window, cx| {
window.prompt(
PromptLevel::Info,
"Are you sure you want to quit?",
None,
&["Quit", "Cancel"],
cx,
)
})
.log_err();
if should_confirm && let Some(workspace) = workspace_windows.first() {
let answer = workspace
.update(cx, |_, window, cx| {
window.prompt(
PromptLevel::Info,
"Are you sure you want to quit?",
None,
&["Quit", "Cancel"],
cx,
)
})
.log_err();
if let Some(answer) = answer {
WAITING_QUIT_CONFIRMATION.store(true, atomic::Ordering::Release);
let answer = answer.await.ok();
WAITING_QUIT_CONFIRMATION.store(false, atomic::Ordering::Release);
if answer != Some(0) {
return Ok(());
}
if let Some(answer) = answer {
WAITING_QUIT_CONFIRMATION.store(true, atomic::Ordering::Release);
let answer = answer.await.ok();
WAITING_QUIT_CONFIRMATION.store(false, atomic::Ordering::Release);
if answer != Some(0) {
return Ok(());
}
}
}
@ -1086,10 +1084,9 @@ fn quit(_: &Quit, cx: &mut App) {
workspace.prepare_to_close(CloseIntent::Quit, window, cx)
})
.log_err()
&& !should_close.await?
{
if !should_close.await? {
return Ok(());
}
return Ok(());
}
}
cx.update(|cx| cx.quit())?;
@ -1633,15 +1630,15 @@ fn open_local_file(
};
if !file_exists {
if let Some(dir_path) = settings_relative_path.parent() {
if worktree.read_with(cx, |tree, _| tree.entry_for_path(dir_path).is_none())? {
project
.update(cx, |project, cx| {
project.create_entry((tree_id, dir_path), true, cx)
})?
.await
.context("worktree was removed")?;
}
if let Some(dir_path) = settings_relative_path.parent()
&& worktree.read_with(cx, |tree, _| tree.entry_for_path(dir_path).is_none())?
{
project
.update(cx, |project, cx| {
project.create_entry((tree_id, dir_path), true, cx)
})?
.await
.context("worktree was removed")?;
}
if worktree.read_with(cx, |tree, _| {
@ -1667,12 +1664,12 @@ fn open_local_file(
editor
.downgrade()
.update(cx, |editor, cx| {
if let Some(buffer) = editor.buffer().read(cx).as_singleton() {
if buffer.read(cx).is_empty() {
buffer.update(cx, |buffer, cx| {
buffer.edit([(0..0, initial_contents)], None, cx)
});
}
if let Some(buffer) = editor.buffer().read(cx).as_singleton()
&& buffer.read(cx).is_empty()
{
buffer.update(cx, |buffer, cx| {
buffer.edit([(0..0, initial_contents)], None, cx)
});
}
})
.ok();