mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
feat(span): impl<'a> PartialEq<str> for Atom<'a> (#2649)
This commit is contained in:
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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user