From 9f238930f1969731869c89956414f4b160b180c0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 22 Aug 2019 15:28:08 +0300 Subject: Don't add `?` bounds as real bounds closes #1709 --- crates/ra_syntax/src/ast/extensions.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ra_syntax/src/ast') diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 2a59cf653..efe261fc2 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -382,6 +382,18 @@ impl ast::WherePred { } } +impl ast::TypeBound { + pub fn question_mark_token(&self) -> Option { + self.syntax() + .children_with_tokens() + .filter_map(|it| it.into_token()) + .find(|it| it.kind() == T![?]) + } + pub fn has_question_mark(&self) -> bool { + self.question_mark_token().is_some() + } +} + impl ast::TraitDef { pub fn is_auto(&self) -> bool { self.syntax().children_with_tokens().any(|t| t.kind() == T![auto]) -- cgit v1.2.3