Skip to content

Commit

Permalink
fix(analyzer): suppression comment fails with inner comments in funct…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
fireairforce committed Dec 9, 2024
1 parent 3914be8 commit ff1d948
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
biome_analyze: patch
---

# fix(analyzer): suppression comment fails with inner comments in functions
25 changes: 9 additions & 16 deletions crates/biome_analyze/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,22 +447,15 @@ where
let suppression = match suppression {
Some(suppression) => Some(suppression),
None => {
let index =
self.suppressions
.line_suppressions
.binary_search_by(|suppression| {
if suppression.text_range.end() < entry.text_range.start() {
Ordering::Less
} else if entry.text_range.end() < suppression.text_range.start() {
Ordering::Greater
} else {
Ordering::Equal
}
});

index
.ok()
.map(|index| &mut self.suppressions.line_suppressions[index])
let index = self.suppressions.line_suppressions.partition_point(|suppression| {
suppression.text_range.end() < entry.text_range.start()
});

if index >= self.suppressions.line_suppressions.len() {
None
} else {
Some(&mut self.suppressions.line_suppressions[index])
}
}
};

Expand Down

0 comments on commit ff1d948

Please sign in to comment.