mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Do not show flyimports in trait or impl declarations
This commit is contained in:
parent
e131bfc747
commit
1c75d64c70
@ -114,6 +114,8 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
|
|||||||
|| ctx.attribute_under_caret.is_some()
|
|| ctx.attribute_under_caret.is_some()
|
||||||
|| ctx.mod_declaration_under_caret.is_some()
|
|| ctx.mod_declaration_under_caret.is_some()
|
||||||
|| ctx.record_lit_syntax.is_some()
|
|| ctx.record_lit_syntax.is_some()
|
||||||
|
|| ctx.has_trait_parent
|
||||||
|
|| ctx.has_impl_parent
|
||||||
{
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@ -1077,4 +1079,52 @@ fn main() {
|
|||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_flyimports_in_traits_and_impl_declarations() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
mod m {
|
||||||
|
pub fn some_fn() -> i32 {
|
||||||
|
42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trait Foo {
|
||||||
|
som$0
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#""#]],
|
||||||
|
);
|
||||||
|
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
mod m {
|
||||||
|
pub fn some_fn() -> i32 {
|
||||||
|
42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
struct Foo;
|
||||||
|
impl Foo {
|
||||||
|
som$0
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#""#]],
|
||||||
|
);
|
||||||
|
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
mod m {
|
||||||
|
pub fn some_fn() -> i32 {
|
||||||
|
42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
struct Foo;
|
||||||
|
trait Bar {}
|
||||||
|
impl Bar for Foo {
|
||||||
|
som$0
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#""#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user