aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/extensions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/extensions.rs')
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs20
1 files changed, 1 insertions, 19 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 1aacb0676..76b7655e6 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -275,7 +275,7 @@ pub enum SelfParamKind {
275impl ast::SelfParam { 275impl ast::SelfParam {
276 pub fn kind(&self) -> SelfParamKind { 276 pub fn kind(&self) -> SelfParamKind {
277 if self.amp_token().is_some() { 277 if self.amp_token().is_some() {
278 if self.amp_mut_token().is_some() { 278 if self.mut_token().is_some() {
279 SelfParamKind::MutRef 279 SelfParamKind::MutRef
280 } else { 280 } else {
281 SelfParamKind::Ref 281 SelfParamKind::Ref
@@ -284,24 +284,6 @@ impl ast::SelfParam {
284 SelfParamKind::Owned 284 SelfParamKind::Owned
285 } 285 }
286 } 286 }
287
288 /// the "mut" in "mut self", not the one in "&mut self"
289 pub fn mut_token(&self) -> Option<SyntaxToken> {
290 self.syntax()
291 .children_with_tokens()
292 .filter_map(|it| it.into_token())
293 .take_while(|it| it.kind() != T![&])
294 .find(|it| it.kind() == T![mut])
295 }
296
297 /// the "mut" in "&mut self", not the one in "mut self"
298 pub fn amp_mut_token(&self) -> Option<SyntaxToken> {
299 self.syntax()
300 .children_with_tokens()
301 .filter_map(|it| it.into_token())
302 .skip_while(|it| it.kind() != T![&])
303 .find(|it| it.kind() == T![mut])
304 }
305} 287}
306 288
307#[derive(Clone, Debug, PartialEq, Eq, Hash)] 289#[derive(Clone, Debug, PartialEq, Eq, Hash)]