aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-11-11 12:04:31 +0000
committerKirill Bulatov <[email protected]>2020-11-12 11:46:02 +0000
commit3481ea96bdf530e70ce0c3568918421564845b0d (patch)
tree7d68a8e4f60632398b5cce3d3331c89c3da1ab12
parent335edf87bc84bdfcc48ab23f12f606ced09dbac7 (diff)
Add a FIXME for non-unified inner attributes
-rw-r--r--crates/assists/src/utils/insert_use.rs9
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. */
881fn main() {}"#, 886fn 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
886use foo::bar::Baz; 891use foo::bar::Baz;
887fn main() {}"#, 892fn main() {}"#,