mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
fix: Do not show functional update completion when already qualified
This commit is contained in:
parent
9e3517f8f3
commit
833de22d0b
@ -20,7 +20,7 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) ->
|
||||
});
|
||||
|
||||
let missing_fields = ctx.sema.record_literal_missing_fields(record_expr);
|
||||
if impl_default_trait && !missing_fields.is_empty() {
|
||||
if impl_default_trait && !missing_fields.is_empty() && ctx.path_qual().is_none() {
|
||||
let completion_text = "..Default::default()";
|
||||
let mut item = CompletionItem::new(
|
||||
CompletionKind::Snippet,
|
||||
|
@ -182,4 +182,24 @@ fn main() {
|
||||
sn Foo {…} Foo { foo1: ${1:()}, foo2: ${2:()} }$0
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
//- minicore:default
|
||||
struct Foo { foo1: u32, foo2: u32 }
|
||||
impl Default for Foo {
|
||||
fn default() -> Self { loop {} }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let thing = 1;
|
||||
let foo = Foo { foo1: 0, foo2: 0 };
|
||||
let foo2 = Foo { thing, ..Default::$0 }
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
fn default() (as Default) fn() -> Self
|
||||
fd foo1 u32
|
||||
fd foo2 u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user