Skip to content

Conversation

@mgeier
Copy link

@mgeier mgeier commented Apr 11, 2020

I might be missing something, but isn't that return unnecessary?

Since this is one of the differences between the Result and the Option example, it might imply to some readers that the Option case only works with explicit returns?

Or is there a reason to use return in one example but not in the other?

@withoutboats
Copy link
Owner

The point was really to show that explicit return works. An ideal formulation would show both explicit and implicit return in both result and option examples.

@mgeier
Copy link
Author

mgeier commented Apr 13, 2020

Yeah, I think it might be confusing if you throw in the explicit return just for the sake of it.

And Clippy doesn't seem to like it, either: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return.

It seems like you are setting a bad example with this example.

I think you should make a separate example if you want to show that explicit returns also work.

Nemo157 added a commit to Nemo157/culpa that referenced this pull request Jun 29, 2023
README: Remove explicit "return" from "Option" example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants