Skip to content

Commit 607325e

Browse files
committed
Simplify comment matching check, assume forward search
1 parent 1ef7b4e commit 607325e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/ruff_linter/src/suppression.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ pub(crate) struct PendingSuppressionComment<'a> {
5151
#[allow(unused)]
5252
impl PendingSuppressionComment<'_> {
5353
/// Whether the comment "matches" another comment, based on indentation and suppressed codes
54+
/// Expects a "forward search" for matches, ie, will only match if the current comment is a
55+
/// "disable" comment and other is the matching "enable" comment.
5456
fn matches(&self, other: &PendingSuppressionComment, source: &str) -> bool {
55-
((self.comment.action == SuppressionAction::Enable
56-
&& other.comment.action == SuppressionAction::Disable)
57-
|| (self.comment.action == SuppressionAction::Disable
58-
&& other.comment.action == SuppressionAction::Enable))
57+
self.comment.action == SuppressionAction::Disable
58+
&& other.comment.action == SuppressionAction::Enable
5959
&& self.indent == other.indent
6060
&& self
6161
.comment

0 commit comments

Comments
 (0)