feat(span): impl<'a> PartialEq<str> for Atom<'a> (#2649)

This commit is contained in:
Boshen authored and GitHub committed 2024-03-09 09:30:14 +00:00
1 parent c72675e89e
commit 8b3de7748b
2 files changed
+7 -1

No files matched your search

@@ -244,7 +244,7 @@ fn check_expression(expr: &Expression, ctx: &LintContext<'_>) -> Option<oxc_span
}
}
Expression::TemplateLiteral(lit) => {
lit.quasi().and_then(|quasi| if quasi == &"then" { Some(lit.span) } else { None })
lit.quasi().and_then(|quasi| if quasi == "then" { Some(lit.span) } else { None })
}
Expression::Identifier(ident) => {
let tab = ctx.semantic().symbols();
+6
View File
@@ -92,6 +92,12 @@ impl<'a> PartialEq<Atom<'a>> for &str {
}
}
impl<'a> PartialEq<str> for Atom<'a> {
fn eq(&self, other: &str) -> bool {
self.as_str() == other
}
}
impl<'a> hash::Hash for Atom<'a> {
fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
self.as_str().hash(hasher);