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
fold's param init func should be FnOnce instead of FnMut #1742
Comments
with the way the |
Got it! A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take this for example
nom/tests/arithmetic.rs
Line 60 in 90af84b
You can't move the captured variable
init
out of the "init" func if it is a non-Copy type, even thoughinit
variable has been moved into the capturing "init" func. That's because FnMut means "init" can be called multiple times. This only works as a matter of fact thatinit
variable isi64
in this case.Since this func is called only once, FnOnce is more suitable here.
The text was updated successfully, but these errors were encountered: