Type inference in closures

This is actually I think similar to an issue I've been dealing with lately, illustrated by this playground.

I settled on using an identity function with the expected bounds to "fix" the type of the inferred closure.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f0e0a991d1cb3933d659e1a4caa11872

1 Like