Closed
Description
Is there a flag that would cause rustfmt
to appropriately add an explicit return
keyword at the end of functions?
Before:
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
if rhs == 0 {
return false;
}
lhs % rhs == 0
}
After:
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
if rhs == 0 {
return false;
}
return lhs % rhs == 0;
}
Diff:
diff --git a/example.rs b/example.rs
index 96b10a6..5af00c8 100644
--- a/example.rs
+++ b/example.rs
@@ -3,5 +3,5 @@ fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
return false;
}
- lhs % rhs == 0
+ return lhs % rhs == 0;
}
\ No newline at end of file
Metadata
Metadata
Assignees
Labels
No labels