add 'use' prefix for any auto-import

This commit is contained in:
mahdi-frms 2021-07-20 18:31:35 +04:30
parent 9c986069ba
commit 65839f4069
2 changed files with 7 additions and 13 deletions

View file

@ -368,9 +368,9 @@ fn main() {
}
"#,
expect![[r#"
st dep::some_module::ThirdStruct
st dep::some_module::AfterThirdStruct
st dep::some_module::ThiiiiiirdStruct
st ThirdStruct (use dep::some_module::ThirdStruct)
st AfterThirdStruct (use dep::some_module::AfterThirdStruct)
st ThiiiiiirdStruct (use dep::some_module::ThiiiiiirdStruct)
"#]],
);
}
@ -817,7 +817,7 @@ fn main() {
check(
fixture,
expect![[r#"
st foo::bar::baz::Item
st Item (use foo::bar::baz::Item)
"#]],
);
@ -997,7 +997,7 @@ fn main() {
TE$0
}"#,
expect![[r#"
ct foo::TEST_CONST
ct TEST_CONST (use foo::TEST_CONST)
"#]],
);
@ -1014,7 +1014,7 @@ fn main() {
te$0
}"#,
expect![[r#"
ct foo::TEST_CONST
ct TEST_CONST (use foo::TEST_CONST)
fn test_function() (use foo::test_function) fn() -> i32
"#]],
);

View file

@ -429,13 +429,7 @@ impl Builder {
{
lookup = lookup.or_else(|| Some(label.clone()));
insert_text = insert_text.or_else(|| Some(label.clone()));
let original_path_label = original_path.to_string();
if original_path_label.ends_with(&label) {
label = original_path_label;
} else {
format_to!(label, " (use {})", original_path)
}
format_to!(label, " (use {})", original_path)
} else if let Some(trait_name) = self.trait_name {
insert_text = insert_text.or_else(|| Some(label.clone()));
format_to!(label, " (as {})", trait_name)