-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad example in FnOnce
documentation
#47091
Comments
As a technical point, all closures are |
Fair point. But as someone new to the documentation, I feel there's an implication in a few places (including the book, but unfortunately that section is frozen) that any |
Yes, it needs to be made more clear that those are totally orthogonal
issues.
…On Sun, Dec 31, 2017 at 1:43 PM, Alexis Hunt ***@***.***> wrote:
Fair point. But as someone new to the documentation, I feel there's an
implication in a few places (including the book, but unfortunately that
section is frozen) that any move closure is only FnOnce and neither FnMut
or Fn, which isn't true.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#47091 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n7VvSR39J4QhiGG2dtcL6v6t_LBEks5tF9XEgaJpZM4RP1zb>
.
|
I personally think that the first example is better to be removed from the FnOnce page, since (in my opinion) it causes more confusion then that it actually helps. I guess that most people looking up FnOnce already know a bit about closures and might already know about the I can imagine that users think the first example can only be called once (because they are on the FnOnce page), but this code also works:
@steveklabnik What do you think about this? I can pick this up if you agree. |
Sounds good to me! |
…nikomatsakis Removed a confusing FnOnce example # Description See rust-lang#47091 for a discussion. ## Changes - Removed an example that might suggest readers that square_x is (only) FnOnce. closes rust-lang#47091
In the documentation for
FnOnce
, there are two examples. The first isThis is not a
FnOnce
closure, as it never moves out of a variable in a way that would prevent it from calling again.The text was updated successfully, but these errors were encountered: