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

@ -510,17 +510,16 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
vim.switch_mode(Mode::Normal, true, window, cx);
}
vim.update_editor(cx, |_, editor, cx| {
if let Some(first_sel) = initial_selections {
if let Some(tx_id) = editor
if let Some(first_sel) = initial_selections
&& let Some(tx_id) = editor
.buffer()
.update(cx, |multi, cx| multi.last_transaction_id(cx))
{
let last_sel = editor.selections.disjoint_anchors();
editor.modify_transaction_selection_history(tx_id, |old| {
old.0 = first_sel;
old.1 = Some(last_sel);
});
}
{
let last_sel = editor.selections.disjoint_anchors();
editor.modify_transaction_selection_history(tx_id, |old| {
old.0 = first_sel;
old.1 = Some(last_sel);
});
}
});
})
@ -1713,14 +1712,12 @@ impl Vim {
match c {
'%' => {
self.update_editor(cx, |_, editor, cx| {
if let Some((_, buffer, _)) = editor.active_excerpt(cx) {
if let Some(file) = buffer.read(cx).file() {
if let Some(local) = file.as_local() {
if let Some(str) = local.path().to_str() {
ret.push_str(str)
}
}
}
if let Some((_, buffer, _)) = editor.active_excerpt(cx)
&& let Some(file) = buffer.read(cx).file()
&& let Some(local) = file.as_local()
&& let Some(str) = local.path().to_str()
{
ret.push_str(str)
}
});
}
@ -1954,19 +1951,19 @@ impl ShellExec {
return;
};
if let Some(mut stdin) = running.stdin.take() {
if let Some(snapshot) = input_snapshot {
let range = range.clone();
cx.background_spawn(async move {
for chunk in snapshot.text_for_range(range) {
if stdin.write_all(chunk.as_bytes()).log_err().is_none() {
return;
}
if let Some(mut stdin) = running.stdin.take()
&& let Some(snapshot) = input_snapshot
{
let range = range.clone();
cx.background_spawn(async move {
for chunk in snapshot.text_for_range(range) {
if stdin.write_all(chunk.as_bytes()).log_err().is_none() {
return;
}
stdin.flush().log_err();
})
.detach();
}
}
stdin.flush().log_err();
})
.detach();
};
let output = cx