From d6dc75f9f22b73faf8c526be69ca43e52d6db1bf Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 7 May 2019 18:53:16 +0200 Subject: Handle auto traits & negative impls We don't pass field types to Chalk yet though, so the auto trait inference won't be correct. --- crates/ra_syntax/src/ast/extensions.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 9cbd2c6b8..f3466c585 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -170,6 +170,10 @@ impl ast::ImplBlock { let second = types.next(); (first, second) } + + pub fn is_negative(&self) -> bool { + self.syntax().children_with_tokens().any(|t| t.kind() == EXCL) + } } #[derive(Debug, Clone, PartialEq, Eq)] @@ -348,3 +352,9 @@ impl ast::WherePred { .find(|it| it.kind() == LIFETIME) } } + +impl ast::TraitDef { + pub fn is_auto(&self) -> bool { + self.syntax().children_with_tokens().any(|t| t.kind() == AUTO_KW) + } +} -- cgit v1.2.3