mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Merge #1045
1045: simplify r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
afe96b75ea
1 changed files with 34 additions and 37 deletions
|
@ -603,9 +603,7 @@ pub enum BinOp {
|
||||||
|
|
||||||
impl BinExpr {
|
impl BinExpr {
|
||||||
fn op_details(&self) -> Option<(&SyntaxNode, BinOp)> {
|
fn op_details(&self) -> Option<(&SyntaxNode, BinOp)> {
|
||||||
self.syntax()
|
self.syntax().children().find_map(|c| match c.kind() {
|
||||||
.children()
|
|
||||||
.filter_map(|c| match c.kind() {
|
|
||||||
PIPEPIPE => Some((c, BinOp::BooleanOr)),
|
PIPEPIPE => Some((c, BinOp::BooleanOr)),
|
||||||
AMPAMP => Some((c, BinOp::BooleanAnd)),
|
AMPAMP => Some((c, BinOp::BooleanAnd)),
|
||||||
EQEQ => Some((c, BinOp::EqualityTest)),
|
EQEQ => Some((c, BinOp::EqualityTest)),
|
||||||
|
@ -639,7 +637,6 @@ impl BinExpr {
|
||||||
CARETEQ => Some((c, BinOp::BitXorAssign)),
|
CARETEQ => Some((c, BinOp::BitXorAssign)),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.next()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn op_kind(&self) -> Option<BinOp> {
|
pub fn op_kind(&self) -> Option<BinOp> {
|
||||||
|
|
Loading…
Reference in a new issue