Skip to content

Commit c003460

Browse files
committed
no score if return ty Other
1 parent 1090876 commit c003460

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
@@ -304,8 +304,10 @@ impl CompletionRelevance {
304304
};
305305

306306
// Prefer functions with no arguments, then functions with self arguments
307-
score += if !asf.has_args { 2 } else { 0 };
308-
score -= if score > 0 && asf.has_self_arg { 1 } else { 0 };
307+
if score > 0 {
308+
score += if !asf.has_args { 2 } else { 0 };
309+
score -= if asf.has_self_arg { 1 } else { 0 };
310+
}
309311

310312
score
311313
})

crates/ide-completion/src/render.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,8 +2075,8 @@ fn test() {
20752075
fn fn_ctr_with_args(…) [type_could_unify]
20762076
fn fn_builder() [type_could_unify]
20772077
fn fn_ctr() [type_could_unify]
2078-
fn fn_other() [type_could_unify]
20792078
me fn_no_ret(…) [type_could_unify]
2079+
fn fn_other() [type_could_unify]
20802080
"#]],
20812081
);
20822082

@@ -2150,8 +2150,8 @@ fn test() {
21502150
fn fn_builder() [type_could_unify]
21512151
fn fn_ctr() [type_could_unify]
21522152
fn fn_ctr2() [type_could_unify]
2153-
fn fn_other() [type_could_unify]
21542153
me fn_no_ret(…) [type_could_unify]
2154+
fn fn_other() [type_could_unify]
21552155
"#]],
21562156
);
21572157

@@ -2183,8 +2183,8 @@ fn test() {
21832183
fn fn_builder() []
21842184
fn fn_ctr() []
21852185
fn fn_ctr2() []
2186-
fn fn_other() []
21872186
me fn_no_ret(…) []
2187+
fn fn_other() []
21882188
"#]],
21892189
);
21902190
}

0 commit comments

Comments
 (0)