From 9f5ec1c0724b46c163ae35117bb32891975d4943 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 18 Oct 2023 22:03:02 +0100 Subject: [PATCH] clippy --- crates/biome_service/src/settings.rs | 6 +++--- crates/biome_service/src/workspace.rs | 28 +++++++++++---------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/crates/biome_service/src/settings.rs b/crates/biome_service/src/settings.rs index 6f99b8103f12..5d13c9e5eb58 100644 --- a/crates/biome_service/src/settings.rs +++ b/crates/biome_service/src/settings.rs @@ -584,7 +584,7 @@ impl OverrideSettings { if included == Some(true) || excluded == Some(false) { if let Some(enabled) = pattern.formatter.enabled { - return Some(enabled == false); + return Some(!enabled); } } } @@ -599,7 +599,7 @@ impl OverrideSettings { if included == Some(true) || excluded == Some(false) { if let Some(enabled) = pattern.linter.enabled { - return Some(enabled == false); + return Some(!enabled); } } } @@ -614,7 +614,7 @@ impl OverrideSettings { if included == Some(true) || excluded == Some(false) { if let Some(enabled) = pattern.organize_imports.enabled { - return Some(enabled == false); + return Some(!enabled); } } } diff --git a/crates/biome_service/src/workspace.rs b/crates/biome_service/src/workspace.rs index 589b1a22e1f8..baa87d06943d 100644 --- a/crates/biome_service/src/workspace.rs +++ b/crates/biome_service/src/workspace.rs @@ -131,14 +131,12 @@ impl FileFeaturesResult { let formatter_disabled = if let Some(disabled) = settings.override_settings.formatter_disabled(path) { disabled + } else if language.is_javascript_like() { + !settings.formatter().enabled || settings.javascript_formatter_disabled() + } else if language.is_json_like() { + !settings.formatter().enabled || settings.json_formatter_disabled() } else { - if language.is_javascript_like() { - !settings.formatter().enabled || settings.javascript_formatter_disabled() - } else if language.is_json_like() { - !settings.formatter().enabled || settings.json_formatter_disabled() - } else { - !settings.formatter().enabled - } + !settings.formatter().enabled }; if formatter_disabled { self.features_supported @@ -150,11 +148,9 @@ impl FileFeaturesResult { self.features_supported .insert(FeatureName::Lint, SupportKind::FeatureNotEnabled); } - } else { - if !settings.linter().enabled { - self.features_supported - .insert(FeatureName::Lint, SupportKind::FeatureNotEnabled); - } + } else if !settings.linter().enabled { + self.features_supported + .insert(FeatureName::Lint, SupportKind::FeatureNotEnabled); } // organize imports @@ -163,11 +159,9 @@ impl FileFeaturesResult { self.features_supported .insert(FeatureName::OrganizeImports, SupportKind::FeatureNotEnabled); } - } else { - if !settings.organize_imports().enabled { - self.features_supported - .insert(FeatureName::OrganizeImports, SupportKind::FeatureNotEnabled); - } + } else if !settings.organize_imports().enabled { + self.features_supported + .insert(FeatureName::OrganizeImports, SupportKind::FeatureNotEnabled); } self