3 ms·
I know this but I can never get my code to compile when doing this. I always seem to get huge type errors even when I know the code is correct. map(|x|foo
by valarauca1 11y ago
I know this but I can never get my code to compile when doing this. I always seem to get huge type errors even when I know the code is correct.
map(|x|foo(x)) //clean compile
map(foo) //type error
The number of times I've had this happen has just lead to me giving up on simply just passing the lambda as a variable instead of wrapping it in another.
- kibwen 11y agoCurious. Can you provide a full code example so that I can try to determine what's causing that error?
- valarauca1 11y agoJust make an issue?
- kibwen 11y agoI don't think it necessarily warrants an issue on the Rust repo, this is just for my own edification.
- Manishearth 11y agoUsually in these cases the culprit is autoderef/deref coercions.
- kibwen 11y agoI don't see anything in `|x| foo(x)` that could be causing `x` to be deref'd.
- Manishearth 11y agoA deref coercion can happen there https://github.com/Manishearth/rust-clippy/issues/116 https://github.com/Manishearth/rust-clippy/issues/116