Skip to content

Commit 592d465

Browse files
committed
fix: forgot to collect filter result
1 parent 60a5cbd commit 592d465

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler-core/src/language_server/code_action.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,10 +1432,11 @@ impl<'ast> ast::visit::Visit<'ast> for AnnotateTopLevelDefinitions<'_> {
14321432
let arguments_to_annotate = fun
14331433
.arguments
14341434
.iter()
1435-
.filter(|argument| argument.annotation.is_none());
1436-
let return_annotation_needed = fun.return_annotation.is_none();
1435+
.filter(|argument| argument.annotation.is_none())
1436+
.collect::<Vec<_>>();
1437+
let needs_return_annotation = fun.return_annotation.is_none();
14371438

1438-
if arguments_to_annotate.is_empty() && !return_annotation_needed {
1439+
if arguments_to_annotate.is_empty() && !needs_return_annotation {
14391440
return;
14401441
}
14411442

@@ -1465,7 +1466,7 @@ impl<'ast> ast::visit::Visit<'ast> for AnnotateTopLevelDefinitions<'_> {
14651466
}
14661467

14671468
// Annotate the return type if it isn't already annotated
1468-
if return_annotation_needed {
1469+
if needs_return_annotation {
14691470
self.edits.insert(
14701471
fun.location.end,
14711472
format!(" -> {}", printer.print_type(&fun.return_type)),

0 commit comments

Comments
 (0)