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.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 03d94170d..d91275b53 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -5,7 +5,7 @@ use itertools::Itertools;
5use ra_parser::SyntaxKind; 5use ra_parser::SyntaxKind;
6 6
7use crate::{ 7use crate::{
8 ast::{self, support, AstNode, AstToken, AttrInput, NameOwner, SyntaxNode}, 8 ast::{self, support, AstNode, AttrInput, NameOwner, SyntaxNode},
9 SmolStr, SyntaxElement, SyntaxToken, T, 9 SmolStr, SyntaxElement, SyntaxToken, T,
10}; 10};
11 11
@@ -327,23 +327,23 @@ impl ast::TypeBound {
327 } 327 }
328 } 328 }
329 329
330 pub fn const_question_token(&self) -> Option<ast::Question> { 330 pub fn const_question_token(&self) -> Option<SyntaxToken> {
331 self.syntax() 331 self.syntax()
332 .children_with_tokens() 332 .children_with_tokens()
333 .filter_map(|it| it.into_token()) 333 .filter_map(|it| it.into_token())
334 .take_while(|it| it.kind() != T![const]) 334 .take_while(|it| it.kind() != T![const])
335 .find_map(ast::Question::cast) 335 .find(|it| it.kind() == T![?])
336 } 336 }
337 337
338 pub fn question_token(&self) -> Option<ast::Question> { 338 pub fn question_token(&self) -> Option<SyntaxToken> {
339 if self.const_token().is_some() { 339 if self.const_token().is_some() {
340 self.syntax() 340 self.syntax()
341 .children_with_tokens() 341 .children_with_tokens()
342 .filter_map(|it| it.into_token()) 342 .filter_map(|it| it.into_token())
343 .skip_while(|it| it.kind() != T![const]) 343 .skip_while(|it| it.kind() != T![const])
344 .find_map(ast::Question::cast) 344 .find(|it| it.kind() == T![?])
345 } else { 345 } else {
346 support::token(&self.syntax) 346 support::token2(&self.syntax, T![?])
347 } 347 }
348 } 348 }
349} 349}
@@ -384,12 +384,12 @@ impl ast::MacroCall {
384} 384}
385 385
386impl ast::LifetimeParam { 386impl ast::LifetimeParam {
387 pub fn lifetime_bounds(&self) -> impl Iterator<Item = ast::Lifetime> { 387 pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> {
388 self.syntax() 388 self.syntax()
389 .children_with_tokens() 389 .children_with_tokens()
390 .filter_map(|it| it.into_token()) 390 .filter_map(|it| it.into_token())
391 .skip_while(|x| x.kind() != T![:]) 391 .skip_while(|x| x.kind() != T![:])
392 .filter_map(ast::Lifetime::cast) 392 .filter(|it| it.kind() == T![lifetime])
393 } 393 }
394} 394}
395 395