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

@ -121,31 +121,30 @@ impl ActiveToolchain {
cx: &mut Context<Self>,
) {
let editor = editor.read(cx);
if let Some((_, buffer, _)) = editor.active_excerpt(cx) {
if let Some(worktree_id) = buffer.read(cx).file().map(|file| file.worktree_id(cx)) {
if self
.active_buffer
.as_ref()
.is_some_and(|(old_worktree_id, old_buffer, _)| {
(old_worktree_id, old_buffer.entity_id())
== (&worktree_id, buffer.entity_id())
})
{
return;
}
let subscription = cx.subscribe_in(
&buffer,
window,
|this, _, event: &BufferEvent, window, cx| {
if matches!(event, BufferEvent::LanguageChanged) {
this._update_toolchain_task = Self::spawn_tracker_task(window, cx);
}
},
);
self.active_buffer = Some((worktree_id, buffer.downgrade(), subscription));
self._update_toolchain_task = Self::spawn_tracker_task(window, cx);
if let Some((_, buffer, _)) = editor.active_excerpt(cx)
&& let Some(worktree_id) = buffer.read(cx).file().map(|file| file.worktree_id(cx))
{
if self
.active_buffer
.as_ref()
.is_some_and(|(old_worktree_id, old_buffer, _)| {
(old_worktree_id, old_buffer.entity_id()) == (&worktree_id, buffer.entity_id())
})
{
return;
}
let subscription = cx.subscribe_in(
&buffer,
window,
|this, _, event: &BufferEvent, window, cx| {
if matches!(event, BufferEvent::LanguageChanged) {
this._update_toolchain_task = Self::spawn_tracker_task(window, cx);
}
},
);
self.active_buffer = Some((worktree_id, buffer.downgrade(), subscription));
self._update_toolchain_task = Self::spawn_tracker_task(window, cx);
}
cx.notify();

View file

@ -211,16 +211,15 @@ impl ToolchainSelectorDelegate {
let _ = this.update_in(cx, move |this, window, cx| {
this.delegate.candidates = available_toolchains;
if let Some(active_toolchain) = active_toolchain {
if let Some(position) = this
if let Some(active_toolchain) = active_toolchain
&& let Some(position) = this
.delegate
.candidates
.toolchains
.iter()
.position(|toolchain| *toolchain == active_toolchain)
{
this.delegate.set_selected_index(position, window, cx);
}
{
this.delegate.set_selected_index(position, window, cx);
}
this.update_matches(this.query(cx), window, cx);
});