diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/expr_extensions.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index ca1773908..139bd3ec0 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -60,7 +60,7 @@ impl ast::PrefixExpr { | |||
60 | } | 60 | } |
61 | 61 | ||
62 | pub fn op_token(&self) -> Option<SyntaxToken> { | 62 | pub fn op_token(&self) -> Option<SyntaxToken> { |
63 | self.syntax().first_child_or_token()?.as_token().cloned() | 63 | self.syntax().first_child_or_token()?.into_token() |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
@@ -132,41 +132,41 @@ pub enum BinOp { | |||
132 | 132 | ||
133 | impl ast::BinExpr { | 133 | impl ast::BinExpr { |
134 | fn op_details(&self) -> Option<(SyntaxToken, BinOp)> { | 134 | fn op_details(&self) -> Option<(SyntaxToken, BinOp)> { |
135 | self.syntax().children_with_tokens().filter_map(|it| it.as_token().cloned()).find_map(|c| { | 135 | self.syntax().children_with_tokens().filter_map(|it| it.into_token()).find_map(|c| match c |
136 | match c.kind() { | 136 | .kind() |
137 | T![||] => Some((c, BinOp::BooleanOr)), | 137 | { |
138 | T![&&] => Some((c, BinOp::BooleanAnd)), | 138 | T![||] => Some((c, BinOp::BooleanOr)), |
139 | T![==] => Some((c, BinOp::EqualityTest)), | 139 | T![&&] => Some((c, BinOp::BooleanAnd)), |
140 | T![!=] => Some((c, BinOp::NegatedEqualityTest)), | 140 | T![==] => Some((c, BinOp::EqualityTest)), |
141 | T![<=] => Some((c, BinOp::LesserEqualTest)), | 141 | T![!=] => Some((c, BinOp::NegatedEqualityTest)), |
142 | T![>=] => Some((c, BinOp::GreaterEqualTest)), | 142 | T![<=] => Some((c, BinOp::LesserEqualTest)), |
143 | T![<] => Some((c, BinOp::LesserTest)), | 143 | T![>=] => Some((c, BinOp::GreaterEqualTest)), |
144 | T![>] => Some((c, BinOp::GreaterTest)), | 144 | T![<] => Some((c, BinOp::LesserTest)), |
145 | T![+] => Some((c, BinOp::Addition)), | 145 | T![>] => Some((c, BinOp::GreaterTest)), |
146 | T![*] => Some((c, BinOp::Multiplication)), | 146 | T![+] => Some((c, BinOp::Addition)), |
147 | T![-] => Some((c, BinOp::Subtraction)), | 147 | T![*] => Some((c, BinOp::Multiplication)), |
148 | T![/] => Some((c, BinOp::Division)), | 148 | T![-] => Some((c, BinOp::Subtraction)), |
149 | T![%] => Some((c, BinOp::Remainder)), | 149 | T![/] => Some((c, BinOp::Division)), |
150 | T![<<] => Some((c, BinOp::LeftShift)), | 150 | T![%] => Some((c, BinOp::Remainder)), |
151 | T![>>] => Some((c, BinOp::RightShift)), | 151 | T![<<] => Some((c, BinOp::LeftShift)), |
152 | T![^] => Some((c, BinOp::BitwiseXor)), | 152 | T![>>] => Some((c, BinOp::RightShift)), |
153 | T![|] => Some((c, BinOp::BitwiseOr)), | 153 | T![^] => Some((c, BinOp::BitwiseXor)), |
154 | T![&] => Some((c, BinOp::BitwiseAnd)), | 154 | T![|] => Some((c, BinOp::BitwiseOr)), |
155 | T![..] => Some((c, BinOp::RangeRightOpen)), | 155 | T![&] => Some((c, BinOp::BitwiseAnd)), |
156 | T![..=] => Some((c, BinOp::RangeRightClosed)), | 156 | T![..] => Some((c, BinOp::RangeRightOpen)), |
157 | T![=] => Some((c, BinOp::Assignment)), | 157 | T![..=] => Some((c, BinOp::RangeRightClosed)), |
158 | T![+=] => Some((c, BinOp::AddAssign)), | 158 | T![=] => Some((c, BinOp::Assignment)), |
159 | T![/=] => Some((c, BinOp::DivAssign)), | 159 | T![+=] => Some((c, BinOp::AddAssign)), |
160 | T![*=] => Some((c, BinOp::MulAssign)), | 160 | T![/=] => Some((c, BinOp::DivAssign)), |
161 | T![%=] => Some((c, BinOp::RemAssign)), | 161 | T![*=] => Some((c, BinOp::MulAssign)), |
162 | T![>>=] => Some((c, BinOp::ShrAssign)), | 162 | T![%=] => Some((c, BinOp::RemAssign)), |
163 | T![<<=] => Some((c, BinOp::ShlAssign)), | 163 | T![>>=] => Some((c, BinOp::ShrAssign)), |
164 | T![-=] => Some((c, BinOp::SubAssign)), | 164 | T![<<=] => Some((c, BinOp::ShlAssign)), |
165 | T![|=] => Some((c, BinOp::BitOrAssign)), | 165 | T![-=] => Some((c, BinOp::SubAssign)), |
166 | T![&=] => Some((c, BinOp::BitAndAssign)), | 166 | T![|=] => Some((c, BinOp::BitOrAssign)), |
167 | T![^=] => Some((c, BinOp::BitXorAssign)), | 167 | T![&=] => Some((c, BinOp::BitAndAssign)), |
168 | _ => None, | 168 | T![^=] => Some((c, BinOp::BitXorAssign)), |
169 | } | 169 | _ => None, |
170 | }) | 170 | }) |
171 | } | 171 | } |
172 | 172 | ||