From 055eb2933ec2cc08c532a151d5f2d3074788c4d1 Mon Sep 17 00:00:00 2001 From: rzvxa Date: Sun, 4 Aug 2024 20:10:47 +0330 Subject: [PATCH] refactor: avoid exposing mutable variable. --- crates/oxc_semantic/src/jsdoc/parser/jsdoc_tag.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/oxc_semantic/src/jsdoc/parser/jsdoc_tag.rs b/crates/oxc_semantic/src/jsdoc/parser/jsdoc_tag.rs index 22d8546df32f87..2fde414755287a 100644 --- a/crates/oxc_semantic/src/jsdoc/parser/jsdoc_tag.rs +++ b/crates/oxc_semantic/src/jsdoc/parser/jsdoc_tag.rs @@ -130,12 +130,15 @@ impl<'a> JSDocTag<'a> { let (type_part, name_comment_content, span_start) = match utils::find_type_range(self.body_raw) { Some((t_start, t_end)) => { - let mut c_start = t_end; + let c_start = { + let mut c_start = t_end; + // +1 if whitespace + if self.body_raw.as_bytes()[c_start] == b' ' { + c_start += 1; + } + c_start + }; - // +1 if whitespace - if self.body_raw.as_bytes()[c_start] == b' ' { - c_start += 1; - } ( Some(JSDocTagTypePart::new( &self.body_raw[t_start..t_end],