Skip to content

Commit

Permalink
Apply lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
camchenry authored and camc314 committed Sep 21, 2024
1 parent 25c2d6b commit 76fdf5b
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,21 @@ fn check_regex(regexp_lit: &RegExpLiteral, pattern_text: &str) -> Option<ErrorKi
let pattern_terms = alternatives.first().map(|it| &it.body)?;

if let Some(Term::BoundaryAssertion(boundary_assert)) = pattern_terms.first() {
if boundary_assert.kind == BoundaryAssertionKind::Start {
if pattern_terms.iter().skip(1).all(|term| matches!(term, Term::Character(_))) {
return Some(ErrorKind::StartsWith);
}
if boundary_assert.kind == BoundaryAssertionKind::Start
&& pattern_terms.iter().skip(1).all(|term| matches!(term, Term::Character(_)))
{
return Some(ErrorKind::StartsWith);
}
}

if let Some(Term::BoundaryAssertion(boundary_assert)) = pattern_terms.last() {
if boundary_assert.kind == BoundaryAssertionKind::End {
if pattern_terms
if boundary_assert.kind == BoundaryAssertionKind::End
&& pattern_terms
.iter()
.take(pattern_terms.len() - 1)
.all(|term| matches!(term, Term::Character(_)))
{
return Some(ErrorKind::EndsWith);
}
{
return Some(ErrorKind::EndsWith);
}
}

Expand Down

0 comments on commit 76fdf5b

Please sign in to comment.