Skip to content

Commit 3481ea9

Browse files
Add a FIXME for non-unified inner attributes
1 parent 335edf8 commit 3481ea9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/assists/src/utils/insert_use.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ impl ImportScope {
7272
if is_inner_node(maybe_inner_node.clone()) {
7373
last_inner_element = Some(NodeOrToken::Node(maybe_inner_node))
7474
} 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.
7580
if let Some(maybe_inner_token) = maybe_inner_node.first_token() {
7681
if is_inner_token(maybe_inner_token.clone()) {
7782
last_inner_element = Some(NodeOrToken::Token(maybe_inner_token))
@@ -877,11 +882,11 @@ use foo::bar::Baz;"#,
877882
"foo::bar::Baz",
878883
r#"/*! Multiline inner comments do not allow any code before them. */
879884
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. */
881886
fn main() {}"#,
882887
r#"/*! Multiline inner comments do not allow any code before them. */
883888
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. */
885890
886891
use foo::bar::Baz;
887892
fn main() {}"#,

0 commit comments

Comments
 (0)