aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs20
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs1
2 files changed, 2 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)]
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 0df7cfe52..f1098755b 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -2307,6 +2307,7 @@ impl ast::TypeAscriptionOwner for SelfParam {}
2307impl ast::AttrsOwner for SelfParam {} 2307impl ast::AttrsOwner for SelfParam {}
2308impl SelfParam { 2308impl SelfParam {
2309 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 2309 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
2310 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
2310 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 2311 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2311 support::token(&self.syntax, T![lifetime]) 2312 support::token(&self.syntax, T![lifetime])
2312 } 2313 }