Skip to content

Commit 07e103b

Browse files
committed
no score if return ty Other
1 parent 217363c commit 07e103b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

crates/ide-completion/src/item.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,10 @@ impl CompletionRelevance {
310310
};
311311

312312
// Prefer functions with no arguments, then functions with self arguments
313-
score += if !asf.has_args { 2 } else { 0 };
314-
score -= if score > 0 && asf.has_self_arg { 1 } else { 0 };
313+
if score > 0 {
314+
score += if !asf.has_args { 2 } else { 0 };
315+
score -= if asf.has_self_arg { 1 } else { 0 };
316+
}
315317

316318
score
317319
})

crates/ide-completion/src/render.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,8 +2078,8 @@ fn test() {
20782078
fn fn_ctr_with_args(…) [type_could_unify]
20792079
fn fn_builder() [type_could_unify]
20802080
fn fn_ctr() [type_could_unify]
2081-
fn fn_other() [type_could_unify]
20822081
me fn_no_ret(…) [type_could_unify]
2082+
fn fn_other() [type_could_unify]
20832083
"#]],
20842084
);
20852085

@@ -2153,8 +2153,8 @@ fn test() {
21532153
fn fn_builder() [type_could_unify]
21542154
fn fn_ctr() [type_could_unify]
21552155
fn fn_ctr2() [type_could_unify]
2156-
fn fn_other() [type_could_unify]
21572156
me fn_no_ret(…) [type_could_unify]
2157+
fn fn_other() [type_could_unify]
21582158
"#]],
21592159
);
21602160

@@ -2186,8 +2186,8 @@ fn test() {
21862186
fn fn_builder() []
21872187
fn fn_ctr() []
21882188
fn fn_ctr2() []
2189-
fn fn_other() []
21902189
me fn_no_ret(…) []
2190+
fn fn_other() []
21912191
"#]],
21922192
);
21932193
}

0 commit comments

Comments
 (0)