fix flyimport showing other types in impl
trait statement
This commit is contained in:
parent
9897662bf7
commit
0e47befaf3
@ -238,6 +238,8 @@ fn import_on_the_fly(
|
||||
(PathKind::Type { location }, ItemInNs::Types(ty)) => {
|
||||
if matches!(location, TypeLocation::TypeBound) {
|
||||
matches!(ty, ModuleDef::Trait(_))
|
||||
} else if matches!(location, TypeLocation::ImplTrait) {
|
||||
matches!(ty, ModuleDef::Trait(_)) || matches!(ty, ModuleDef::Module(_))
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
@ -1397,3 +1397,22 @@ pub use bridge2::server2::Span2;
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flyimport_only_traits_in_impl_trait_block() {
|
||||
check(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:dep
|
||||
pub struct Bar;
|
||||
|
||||
impl Foo$0 for Bar { }
|
||||
//- /lib.rs crate:dep
|
||||
pub trait FooTrait;
|
||||
|
||||
pub struct FooStruct;
|
||||
"#,
|
||||
expect![[r#"
|
||||
tt FooTrait (use dep::FooTrait)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user