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:
parent
cac80e2ebd
commit
ceec258bf3
3 changed files with 117 additions and 126 deletions
|
@ -93,8 +93,8 @@ impl DivInspector {
|
||||||
Ok((json_style_buffer, rust_style_buffer)) => {
|
Ok((json_style_buffer, rust_style_buffer)) => {
|
||||||
this.update_in(cx, |this, window, cx| {
|
this.update_in(cx, |this, window, cx| {
|
||||||
this.state = State::BuffersLoaded {
|
this.state = State::BuffersLoaded {
|
||||||
json_style_buffer: json_style_buffer,
|
json_style_buffer,
|
||||||
rust_style_buffer: rust_style_buffer,
|
rust_style_buffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize editors immediately instead of waiting for
|
// Initialize editors immediately instead of waiting for
|
||||||
|
@ -200,8 +200,8 @@ impl DivInspector {
|
||||||
cx.subscribe_in(&json_style_editor, window, {
|
cx.subscribe_in(&json_style_editor, window, {
|
||||||
let id = id.clone();
|
let id = id.clone();
|
||||||
let rust_style_buffer = rust_style_buffer.clone();
|
let rust_style_buffer = rust_style_buffer.clone();
|
||||||
move |this, editor, event: &EditorEvent, window, cx| match event {
|
move |this, editor, event: &EditorEvent, window, cx| {
|
||||||
EditorEvent::BufferEdited => {
|
if event == &EditorEvent::BufferEdited {
|
||||||
let style_json = editor.read(cx).text(cx);
|
let style_json = editor.read(cx).text(cx);
|
||||||
match serde_json_lenient::from_str_lenient::<StyleRefinement>(&style_json) {
|
match serde_json_lenient::from_str_lenient::<StyleRefinement>(&style_json) {
|
||||||
Ok(new_style) => {
|
Ok(new_style) => {
|
||||||
|
@ -243,7 +243,6 @@ impl DivInspector {
|
||||||
Err(err) => this.json_style_error = Some(err.to_string().into()),
|
Err(err) => this.json_style_error = Some(err.to_string().into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
@ -251,11 +250,10 @@ impl DivInspector {
|
||||||
cx.subscribe(&rust_style_editor, {
|
cx.subscribe(&rust_style_editor, {
|
||||||
let json_style_buffer = json_style_buffer.clone();
|
let json_style_buffer = json_style_buffer.clone();
|
||||||
let rust_style_buffer = rust_style_buffer.clone();
|
let rust_style_buffer = rust_style_buffer.clone();
|
||||||
move |this, _editor, event: &EditorEvent, cx| match event {
|
move |this, _editor, event: &EditorEvent, cx| {
|
||||||
EditorEvent::BufferEdited => {
|
if let EditorEvent::BufferEdited = event {
|
||||||
this.update_json_style_from_rust(&json_style_buffer, &rust_style_buffer, cx);
|
this.update_json_style_from_rust(&json_style_buffer, &rust_style_buffer, cx);
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
@ -271,24 +269,20 @@ impl DivInspector {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset_style(&mut self, cx: &mut App) {
|
fn reset_style(&mut self, cx: &mut App) {
|
||||||
match &self.state {
|
if let State::Ready {
|
||||||
State::Ready {
|
|
||||||
rust_style_buffer,
|
rust_style_buffer,
|
||||||
json_style_buffer,
|
json_style_buffer,
|
||||||
..
|
..
|
||||||
} => {
|
} = &self.state
|
||||||
if let Err(err) = self.reset_style_editors(
|
{
|
||||||
&rust_style_buffer.clone(),
|
if let Err(err) =
|
||||||
&json_style_buffer.clone(),
|
self.reset_style_editors(&rust_style_buffer.clone(), &json_style_buffer.clone(), cx)
|
||||||
cx,
|
{
|
||||||
) {
|
|
||||||
self.json_style_error = Some(format!("{err}").into());
|
self.json_style_error = Some(format!("{err}").into());
|
||||||
} else {
|
} else {
|
||||||
self.json_style_error = None;
|
self.json_style_error = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset_style_editors(
|
fn reset_style_editors(
|
||||||
|
|
|
@ -2125,8 +2125,7 @@ impl SshRemoteConnection {
|
||||||
.env("RUSTFLAGS", &rust_flags),
|
.env("RUSTFLAGS", &rust_flags),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
} else {
|
} else if build_remote_server.contains("cross") {
|
||||||
if build_remote_server.contains("cross") {
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use util::paths::SanitizedPath;
|
use util::paths::SanitizedPath;
|
||||||
|
|
||||||
|
@ -2201,8 +2200,7 @@ impl SshRemoteConnection {
|
||||||
|
|
||||||
delegate.set_status(Some("Installing cargo-zigbuild for cross-compilation"), cx);
|
delegate.set_status(Some("Installing cargo-zigbuild for cross-compilation"), cx);
|
||||||
log::info!("installing cargo-zigbuild");
|
log::info!("installing cargo-zigbuild");
|
||||||
run_cmd(Command::new("cargo").args(["install", "--locked", "cargo-zigbuild"]))
|
run_cmd(Command::new("cargo").args(["install", "--locked", "cargo-zigbuild"])).await?;
|
||||||
.await?;
|
|
||||||
|
|
||||||
delegate.set_status(
|
delegate.set_status(
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
|
@ -2227,7 +2225,6 @@ impl SshRemoteConnection {
|
||||||
.env("RUSTFLAGS", &rust_flags),
|
.env("RUSTFLAGS", &rust_flags),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let bin_path = Path::new("target")
|
let bin_path = Path::new("target")
|
||||||
.join("remote_server")
|
.join("remote_server")
|
||||||
|
|
|
@ -299,11 +299,11 @@ impl NeovimConnection {
|
||||||
if let Some(NeovimData::Get { .. }) = self.data.front() {
|
if let Some(NeovimData::Get { .. }) = self.data.front() {
|
||||||
self.data.pop_front();
|
self.data.pop_front();
|
||||||
};
|
};
|
||||||
if let Some(NeovimData::ReadRegister { name, value }) = self.data.pop_front() {
|
if let Some(NeovimData::ReadRegister { name, value }) = self.data.pop_front()
|
||||||
if name == register {
|
&& name == register
|
||||||
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
panic!("operation does not match recorded script. re-record with --features=neovim")
|
panic!("operation does not match recorded script. re-record with --features=neovim")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue