Some clippy fixes (#36544)

These showed up today, so just applied the simplifications, which were
mostly switching matches to if let

Release Notes:

- N/A
This commit is contained in:
Ben Brandt 2025-08-20 05:40:39 +02:00 committed by GitHub
parent cac80e2ebd
commit ceec258bf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 117 additions and 126 deletions

View file

@ -93,8 +93,8 @@ impl DivInspector {
Ok((json_style_buffer, rust_style_buffer)) => {
this.update_in(cx, |this, window, cx| {
this.state = State::BuffersLoaded {
json_style_buffer: json_style_buffer,
rust_style_buffer: rust_style_buffer,
json_style_buffer,
rust_style_buffer,
};
// Initialize editors immediately instead of waiting for
@ -200,8 +200,8 @@ impl DivInspector {
cx.subscribe_in(&json_style_editor, window, {
let id = id.clone();
let rust_style_buffer = rust_style_buffer.clone();
move |this, editor, event: &EditorEvent, window, cx| match event {
EditorEvent::BufferEdited => {
move |this, editor, event: &EditorEvent, window, cx| {
if event == &EditorEvent::BufferEdited {
let style_json = editor.read(cx).text(cx);
match serde_json_lenient::from_str_lenient::<StyleRefinement>(&style_json) {
Ok(new_style) => {
@ -243,7 +243,6 @@ impl DivInspector {
Err(err) => this.json_style_error = Some(err.to_string().into()),
}
}
_ => {}
}
})
.detach();
@ -251,11 +250,10 @@ impl DivInspector {
cx.subscribe(&rust_style_editor, {
let json_style_buffer = json_style_buffer.clone();
let rust_style_buffer = rust_style_buffer.clone();
move |this, _editor, event: &EditorEvent, cx| match event {
EditorEvent::BufferEdited => {
move |this, _editor, event: &EditorEvent, cx| {
if let EditorEvent::BufferEdited = event {
this.update_json_style_from_rust(&json_style_buffer, &rust_style_buffer, cx);
}
_ => {}
}
})
.detach();
@ -271,24 +269,20 @@ impl DivInspector {
}
fn reset_style(&mut self, cx: &mut App) {
match &self.state {
State::Ready {
if let State::Ready {
rust_style_buffer,
json_style_buffer,
..
} => {
if let Err(err) = self.reset_style_editors(
&rust_style_buffer.clone(),
&json_style_buffer.clone(),
cx,
) {
} = &self.state
{
if let Err(err) =
self.reset_style_editors(&rust_style_buffer.clone(), &json_style_buffer.clone(), cx)
{
self.json_style_error = Some(format!("{err}").into());
} else {
self.json_style_error = None;
}
}
_ => {}
}
}
fn reset_style_editors(

View file

@ -2125,8 +2125,7 @@ impl SshRemoteConnection {
.env("RUSTFLAGS", &rust_flags),
)
.await?;
} else {
if build_remote_server.contains("cross") {
} else if build_remote_server.contains("cross") {
#[cfg(target_os = "windows")]
use util::paths::SanitizedPath;
@ -2201,8 +2200,7 @@ impl SshRemoteConnection {
delegate.set_status(Some("Installing cargo-zigbuild for cross-compilation"), cx);
log::info!("installing cargo-zigbuild");
run_cmd(Command::new("cargo").args(["install", "--locked", "cargo-zigbuild"]))
.await?;
run_cmd(Command::new("cargo").args(["install", "--locked", "cargo-zigbuild"])).await?;
delegate.set_status(
Some(&format!(
@ -2227,7 +2225,6 @@ impl SshRemoteConnection {
.env("RUSTFLAGS", &rust_flags),
)
.await?;
}
};
let bin_path = Path::new("target")
.join("remote_server")

View file

@ -299,11 +299,11 @@ impl NeovimConnection {
if let Some(NeovimData::Get { .. }) = self.data.front() {
self.data.pop_front();
};
if let Some(NeovimData::ReadRegister { name, value }) = self.data.pop_front() {
if name == register {
if let Some(NeovimData::ReadRegister { name, value }) = self.data.pop_front()
&& name == register
{
return value;
}
}
panic!("operation does not match recorded script. re-record with --features=neovim")
}