Complete closure expression by expected type
Author: flodieboldCreated Apr 27, 2021Updated Oct 1, 2026
LabelsE-hardA-tyA-completionS-actionable
In a place where something implementing Fn/FnMut/FnOnce is expected, we should complete |x0, x1| $0 and move |x0, x1| $0, with the correct number of parameters of course.
This isn't completely trivial because it's not about the expected type, but about a trait bound on it. We should probably carry them over from type checking somehow; a simpler approach for now might be to only make it work if we're in a function parameter.
We might also want to make | a completion trigger character then.
CC #8629
Source: rust-lang/rust-analyzer