From b10ed1141c9430b17a09e54cd3c81300deff79fd Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:43:11 +0000 Subject: [PATCH] refactor(linter): make unwrap unconditional (#12371) Refactor. When we know something is always `Some`, in my view it's preferable to `unwrap` it rather than exiting early if `None`. This makes the code less ambiguous - otherwise it reads like maybe it's `Some`, maybe it's `None`. --- crates/oxc_linter/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oxc_linter/src/lib.rs b/crates/oxc_linter/src/lib.rs index a13609d413452..3011ca0a09511 100644 --- a/crates/oxc_linter/src/lib.rs +++ b/crates/oxc_linter/src/lib.rs @@ -232,8 +232,8 @@ impl Linter { return; } - // TODO: Error or `unwrap` instead of `return`? - let Some(external_linter) = &self.external_linter else { return }; + // `external_linter` always exists when `oxlint2` feature is enabled + let external_linter = self.external_linter.as_ref().unwrap(); let result = (external_linter.run)( path.to_str().unwrap().to_string(),