aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/extensions.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-19 17:05:34 +0100
committerAleksey Kladov <[email protected]>2019-07-19 17:05:34 +0100
commit191a6ba330bd47fc3b9cc05d59b2d456b471eb89 (patch)
tree9c7996d6ac7323da527fb53171b9275545d1640a /crates/ra_syntax/src/ast/extensions.rs
parenta6df224f7d3893f5a742b58818eac6c5a953721d (diff)
convenience api
Diffstat (limited to 'crates/ra_syntax/src/ast/extensions.rs')
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 5420f67ff..753fc42c6 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -239,7 +239,7 @@ impl ast::FnDef {
239 pub fn semicolon_token(&self) -> Option<SyntaxToken> { 239 pub fn semicolon_token(&self) -> Option<SyntaxToken> {
240 self.syntax() 240 self.syntax()
241 .last_child_or_token() 241 .last_child_or_token()
242 .and_then(|it| it.as_token().cloned()) 242 .and_then(|it| it.into_token())
243 .filter(|it| it.kind() == T![;]) 243 .filter(|it| it.kind() == T![;])
244 } 244 }
245} 245}
@@ -332,7 +332,7 @@ impl ast::SelfParam {
332 pub fn self_kw_token(&self) -> SyntaxToken { 332 pub fn self_kw_token(&self) -> SyntaxToken {
333 self.syntax() 333 self.syntax()
334 .children_with_tokens() 334 .children_with_tokens()
335 .filter_map(|it| it.as_token().cloned()) 335 .filter_map(|it| it.into_token())
336 .find(|it| it.kind() == T![self]) 336 .find(|it| it.kind() == T![self])
337 .expect("invalid tree: self param must have self") 337 .expect("invalid tree: self param must have self")
338 } 338 }
@@ -361,7 +361,7 @@ impl ast::LifetimeParam {
361 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 361 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
362 self.syntax() 362 self.syntax()
363 .children_with_tokens() 363 .children_with_tokens()
364 .filter_map(|it| it.as_token().cloned()) 364 .filter_map(|it| it.into_token())
365 .find(|it| it.kind() == LIFETIME) 365 .find(|it| it.kind() == LIFETIME)
366 } 366 }
367} 367}
@@ -370,7 +370,7 @@ impl ast::WherePred {
370 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 370 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
371 self.syntax() 371 self.syntax()
372 .children_with_tokens() 372 .children_with_tokens()
373 .filter_map(|it| it.as_token().cloned()) 373 .filter_map(|it| it.into_token())
374 .find(|it| it.kind() == LIFETIME) 374 .find(|it| it.kind() == LIFETIME)
375 } 375 }
376} 376}