Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
parent
9e8ec72bd5
commit
8f567383e4
281 changed files with 6628 additions and 7089 deletions
|
@ -93,10 +93,9 @@ pub fn is_version_compatible(
|
|||
.wasm_api_version
|
||||
.as_ref()
|
||||
.and_then(|wasm_api_version| SemanticVersion::from_str(wasm_api_version).ok())
|
||||
&& !is_supported_wasm_api_version(release_channel, wasm_api_version)
|
||||
{
|
||||
if !is_supported_wasm_api_version(release_channel, wasm_api_version) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
|
@ -292,19 +291,17 @@ impl ExtensionStore {
|
|||
// it must be asynchronously rebuilt.
|
||||
let mut extension_index = ExtensionIndex::default();
|
||||
let mut extension_index_needs_rebuild = true;
|
||||
if let Ok(index_content) = index_content {
|
||||
if let Some(index) = serde_json::from_str(&index_content).log_err() {
|
||||
extension_index = index;
|
||||
if let (Ok(Some(index_metadata)), Ok(Some(extensions_metadata))) =
|
||||
(index_metadata, extensions_metadata)
|
||||
{
|
||||
if index_metadata
|
||||
.mtime
|
||||
.bad_is_greater_than(extensions_metadata.mtime)
|
||||
{
|
||||
extension_index_needs_rebuild = false;
|
||||
}
|
||||
}
|
||||
if let Ok(index_content) = index_content
|
||||
&& let Some(index) = serde_json::from_str(&index_content).log_err()
|
||||
{
|
||||
extension_index = index;
|
||||
if let (Ok(Some(index_metadata)), Ok(Some(extensions_metadata))) =
|
||||
(index_metadata, extensions_metadata)
|
||||
&& index_metadata
|
||||
.mtime
|
||||
.bad_is_greater_than(extensions_metadata.mtime)
|
||||
{
|
||||
extension_index_needs_rebuild = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,10 +389,9 @@ impl ExtensionStore {
|
|||
|
||||
if let Some(path::Component::Normal(extension_dir_name)) =
|
||||
event_path.components().next()
|
||||
&& let Some(extension_id) = extension_dir_name.to_str()
|
||||
{
|
||||
if let Some(extension_id) = extension_dir_name.to_str() {
|
||||
reload_tx.unbounded_send(Some(extension_id.into())).ok();
|
||||
}
|
||||
reload_tx.unbounded_send(Some(extension_id.into())).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -763,8 +759,8 @@ impl ExtensionStore {
|
|||
if let ExtensionOperation::Install = operation {
|
||||
this.update( cx, |this, cx| {
|
||||
cx.emit(Event::ExtensionInstalled(extension_id.clone()));
|
||||
if let Some(events) = ExtensionEvents::try_global(cx) {
|
||||
if let Some(manifest) = this.extension_manifest_for_id(&extension_id) {
|
||||
if let Some(events) = ExtensionEvents::try_global(cx)
|
||||
&& let Some(manifest) = this.extension_manifest_for_id(&extension_id) {
|
||||
events.update(cx, |this, cx| {
|
||||
this.emit(
|
||||
extension::Event::ExtensionInstalled(manifest.clone()),
|
||||
|
@ -772,7 +768,6 @@ impl ExtensionStore {
|
|||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
|
@ -912,12 +907,12 @@ impl ExtensionStore {
|
|||
|
||||
extension_store.update(cx, |_, cx| {
|
||||
cx.emit(Event::ExtensionUninstalled(extension_id.clone()));
|
||||
if let Some(events) = ExtensionEvents::try_global(cx) {
|
||||
if let Some(manifest) = extension_manifest {
|
||||
events.update(cx, |this, cx| {
|
||||
this.emit(extension::Event::ExtensionUninstalled(manifest.clone()), cx)
|
||||
});
|
||||
}
|
||||
if let Some(events) = ExtensionEvents::try_global(cx)
|
||||
&& let Some(manifest) = extension_manifest
|
||||
{
|
||||
events.update(cx, |this, cx| {
|
||||
this.emit(extension::Event::ExtensionUninstalled(manifest.clone()), cx)
|
||||
});
|
||||
}
|
||||
})?;
|
||||
|
||||
|
@ -997,12 +992,12 @@ impl ExtensionStore {
|
|||
this.update(cx, |this, cx| this.reload(None, cx))?.await;
|
||||
this.update(cx, |this, cx| {
|
||||
cx.emit(Event::ExtensionInstalled(extension_id.clone()));
|
||||
if let Some(events) = ExtensionEvents::try_global(cx) {
|
||||
if let Some(manifest) = this.extension_manifest_for_id(&extension_id) {
|
||||
events.update(cx, |this, cx| {
|
||||
this.emit(extension::Event::ExtensionInstalled(manifest.clone()), cx)
|
||||
});
|
||||
}
|
||||
if let Some(events) = ExtensionEvents::try_global(cx)
|
||||
&& let Some(manifest) = this.extension_manifest_for_id(&extension_id)
|
||||
{
|
||||
events.update(cx, |this, cx| {
|
||||
this.emit(extension::Event::ExtensionInstalled(manifest.clone()), cx)
|
||||
});
|
||||
}
|
||||
})?;
|
||||
|
||||
|
@ -1788,10 +1783,10 @@ impl ExtensionStore {
|
|||
let connection_options = client.read(cx).connection_options();
|
||||
let ssh_url = connection_options.ssh_url();
|
||||
|
||||
if let Some(existing_client) = self.ssh_clients.get(&ssh_url) {
|
||||
if existing_client.upgrade().is_some() {
|
||||
return;
|
||||
}
|
||||
if let Some(existing_client) = self.ssh_clients.get(&ssh_url)
|
||||
&& existing_client.upgrade().is_some()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self.ssh_clients.insert(ssh_url, client.downgrade());
|
||||
|
|
|
@ -701,16 +701,15 @@ pub fn parse_wasm_extension_version(
|
|||
for part in wasmparser::Parser::new(0).parse_all(wasm_bytes) {
|
||||
if let wasmparser::Payload::CustomSection(s) =
|
||||
part.context("error parsing wasm extension")?
|
||||
&& s.name() == "zed:api-version"
|
||||
{
|
||||
if s.name() == "zed:api-version" {
|
||||
version = parse_wasm_extension_version_custom_section(s.data());
|
||||
if version.is_none() {
|
||||
bail!(
|
||||
"extension {} has invalid zed:api-version section: {:?}",
|
||||
extension_id,
|
||||
s.data()
|
||||
);
|
||||
}
|
||||
version = parse_wasm_extension_version_custom_section(s.data());
|
||||
if version.is_none() {
|
||||
bail!(
|
||||
"extension {} has invalid zed:api-version section: {:?}",
|
||||
extension_id,
|
||||
s.data()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue