From 6eeec5d75f0757c341440198fde90c3363226307 Mon Sep 17 00:00:00 2001 From: AdnoC Date: Tue, 29 Dec 2020 22:46:34 -0700 Subject: Smarter bracketed use diagnostic --- crates/syntax/src/ast/node_ext.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index c45cb514a..8a8c2319b 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -193,6 +193,14 @@ impl ast::UseTreeList { .and_then(ast::UseTree::cast) .expect("UseTreeLists are always nested in UseTrees") } + + pub fn has_inner_comment(&self) -> bool { + self.syntax() + .children_with_tokens() + .filter_map(|it| it.into_token()) + .find_map(ast::Comment::cast) + .is_some() + } } impl ast::Impl { -- cgit v1.2.3 From ddbf484acf15efd73b61ac80a941730b507c01de Mon Sep 17 00:00:00 2001 From: AdnoC Date: Tue, 29 Dec 2020 22:56:00 -0700 Subject: indentation --- crates/syntax/src/ast/node_ext.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 8a8c2319b..2aa472fb4 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -197,9 +197,9 @@ impl ast::UseTreeList { pub fn has_inner_comment(&self) -> bool { self.syntax() .children_with_tokens() - .filter_map(|it| it.into_token()) - .find_map(ast::Comment::cast) - .is_some() + .filter_map(|it| it.into_token()) + .find_map(ast::Comment::cast) + .is_some() } } -- cgit v1.2.3