diff options
-rw-r--r-- | crates/assists/src/utils/insert_use.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs index c4de83f77..5d726370a 100644 --- a/crates/assists/src/utils/insert_use.rs +++ b/crates/assists/src/utils/insert_use.rs | |||
@@ -72,6 +72,11 @@ impl ImportScope { | |||
72 | if is_inner_node(maybe_inner_node.clone()) { | 72 | if is_inner_node(maybe_inner_node.clone()) { |
73 | last_inner_element = Some(NodeOrToken::Node(maybe_inner_node)) | 73 | last_inner_element = Some(NodeOrToken::Node(maybe_inner_node)) |
74 | } else { | 74 | } else { |
75 | // FIXME: https://doc.rust-lang.org/reference/comments.html#doc-comments | ||
76 | // states that inner comments (`//!` and `/*!`) are equal to inner attribute `#![doc="..."]` | ||
77 | // yet RA treats them differently now: inner attributes never belong to child nodes, | ||
78 | // but inner comments can, ergo this check. | ||
79 | // We need to align this and treat both cases the same way. | ||
75 | if let Some(maybe_inner_token) = maybe_inner_node.first_token() { | 80 | if let Some(maybe_inner_token) = maybe_inner_node.first_token() { |
76 | if is_inner_token(maybe_inner_token.clone()) { | 81 | if is_inner_token(maybe_inner_token.clone()) { |
77 | last_inner_element = Some(NodeOrToken::Token(maybe_inner_token)) | 82 | last_inner_element = Some(NodeOrToken::Token(maybe_inner_token)) |
@@ -877,11 +882,11 @@ use foo::bar::Baz;"#, | |||
877 | "foo::bar::Baz", | 882 | "foo::bar::Baz", |
878 | r#"/*! Multiline inner comments do not allow any code before them. */ | 883 | r#"/*! Multiline inner comments do not allow any code before them. */ |
879 | 884 | ||
880 | /*! RA considers this inner comment belonging to the function, yet we still cannot place the code before it. */ | 885 | /*! Still an inner comment, cannot place any code before. */ |
881 | fn main() {}"#, | 886 | fn main() {}"#, |
882 | r#"/*! Multiline inner comments do not allow any code before them. */ | 887 | r#"/*! Multiline inner comments do not allow any code before them. */ |
883 | 888 | ||
884 | /*! RA considers this inner comment belonging to the function, yet we still cannot place the code before it. */ | 889 | /*! Still an inner comment, cannot place any code before. */ |
885 | 890 | ||
886 | use foo::bar::Baz; | 891 | use foo::bar::Baz; |
887 | fn main() {}"#, | 892 | fn main() {}"#, |