Annotating variables with "impl Trait" could be helpful to annotate futures or streams that you don't know the exact type of:
fn process_stream(stream: impl Stream<Item = u64>) -> impl Stream<Item = String> {
let intermediate_result: impl Stream<Item = String> =
stream.map(|item| item.to_string());
intermediate_result.map(|item| format!("Prefix {} Suffix", item))
}
This example is quite simple and here we wouldn't get much benefit, but for longer filter/map chains, annotating intermediate result types can be quite helpful.
Are there plans to allow this?