Clippy warnings to remove `return` a bit too much?

You can also transform code like this into an "actual" early return, which will make Clippy happy, and reduce nesting:

fn foo() -> Option<u32> {
    if early_return_condition {
        return None;
    }
    some_other_calculation()
}
4 Likes