diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/extensions.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index fc252e79c..11ec70bc0 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -279,7 +279,7 @@ pub enum SelfParamKind { | |||
279 | impl ast::SelfParam { | 279 | impl ast::SelfParam { |
280 | pub fn kind(&self) -> SelfParamKind { | 280 | pub fn kind(&self) -> SelfParamKind { |
281 | if self.amp_token().is_some() { | 281 | if self.amp_token().is_some() { |
282 | if self.amp_mut_kw_token().is_some() { | 282 | if self.amp_mut_token().is_some() { |
283 | SelfParamKind::MutRef | 283 | SelfParamKind::MutRef |
284 | } else { | 284 | } else { |
285 | SelfParamKind::Ref | 285 | SelfParamKind::Ref |
@@ -290,21 +290,21 @@ impl ast::SelfParam { | |||
290 | } | 290 | } |
291 | 291 | ||
292 | /// the "mut" in "mut self", not the one in "&mut self" | 292 | /// the "mut" in "mut self", not the one in "&mut self" |
293 | pub fn mut_kw_token(&self) -> Option<ast::MutKw> { | 293 | pub fn mut_token(&self) -> Option<SyntaxToken> { |
294 | self.syntax() | 294 | self.syntax() |
295 | .children_with_tokens() | 295 | .children_with_tokens() |
296 | .filter_map(|it| it.into_token()) | 296 | .filter_map(|it| it.into_token()) |
297 | .take_while(|it| it.kind() != T![&]) | 297 | .take_while(|it| it.kind() != T![&]) |
298 | .find_map(ast::MutKw::cast) | 298 | .find(|it| it.kind() == T![mut]) |
299 | } | 299 | } |
300 | 300 | ||
301 | /// the "mut" in "&mut self", not the one in "mut self" | 301 | /// the "mut" in "&mut self", not the one in "mut self" |
302 | pub fn amp_mut_kw_token(&self) -> Option<ast::MutKw> { | 302 | pub fn amp_mut_token(&self) -> Option<SyntaxToken> { |
303 | self.syntax() | 303 | self.syntax() |
304 | .children_with_tokens() | 304 | .children_with_tokens() |
305 | .filter_map(|it| it.into_token()) | 305 | .filter_map(|it| it.into_token()) |
306 | .skip_while(|it| it.kind() != T![&]) | 306 | .skip_while(|it| it.kind() != T![&]) |
307 | .find_map(ast::MutKw::cast) | 307 | .find(|it| it.kind() == T![mut]) |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
@@ -340,7 +340,7 @@ impl ast::TypeBound { | |||
340 | } | 340 | } |
341 | 341 | ||
342 | pub fn question_token(&self) -> Option<ast::Question> { | 342 | pub fn question_token(&self) -> Option<ast::Question> { |
343 | if self.const_kw_token().is_some() { | 343 | if self.const_token().is_some() { |
344 | self.syntax() | 344 | self.syntax() |
345 | .children_with_tokens() | 345 | .children_with_tokens() |
346 | .filter_map(|it| it.into_token()) | 346 | .filter_map(|it| it.into_token()) |
@@ -364,11 +364,11 @@ impl ast::Visibility { | |||
364 | pub fn kind(&self) -> VisibilityKind { | 364 | pub fn kind(&self) -> VisibilityKind { |
365 | if let Some(path) = support::children(self.syntax()).next() { | 365 | if let Some(path) = support::children(self.syntax()).next() { |
366 | VisibilityKind::In(path) | 366 | VisibilityKind::In(path) |
367 | } else if self.crate_kw_token().is_some() { | 367 | } else if self.crate_token().is_some() { |
368 | VisibilityKind::PubCrate | 368 | VisibilityKind::PubCrate |
369 | } else if self.super_kw_token().is_some() { | 369 | } else if self.super_token().is_some() { |
370 | VisibilityKind::PubSuper | 370 | VisibilityKind::PubSuper |
371 | } else if self.self_kw_token().is_some() { | 371 | } else if self.self_token().is_some() { |
372 | VisibilityKind::PubSuper | 372 | VisibilityKind::PubSuper |
373 | } else { | 373 | } else { |
374 | VisibilityKind::Pub | 374 | VisibilityKind::Pub |