9646: add 'use' prefix for any auto-import r=Veykril a=mahdi-frms

Fixes #9643

looks like there was an if condition that had to be removed.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
This commit is contained in:
bors[bot] 2021-07-20 14:09:24 +00:00 committed by GitHub
commit a646ddf230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)