Skip to content

Commit 212ab20

Browse files
ankddevlpil
authored andcommitted
fix: forgot to collect filter result
1 parent ac7fb70 commit 212ab20

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
@@ -1433,10 +1433,11 @@ impl<'ast> ast::visit::Visit<'ast> for AnnotateTopLevelDefinitions<'_> {
14331433
let arguments_to_annotate = fun
14341434
.arguments
14351435
.iter()
1436-
.filter(|argument| argument.annotation.is_none());
1437-
let return_annotation_needed = fun.return_annotation.is_none();
1436+
.filter(|argument| argument.annotation.is_none())
1437+
.collect::<Vec<_>>();
1438+
let needs_return_annotation = fun.return_annotation.is_none();
14381439

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

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

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

0 commit comments

Comments
 (0)