Scoping formatting macros (format!, write!, writeln!, print!, etc)

This PR changes format! to be scoped due to limitations when writing async code (Arguments is !Sync and !Send). However, writing some async code made me realize that write! (and others) suffer from the same disease.

Instead of writing:

write!(file, "Foo: {}", foo).await?

I had to write (because of compiler errors):

let fut = write!(file, "Foo: {}", foo);
fut?

This is exactly what the PR is trying to fix, but for format!! Do you agree that we should fix it for them all (write!, writeln!, print!, println!, eprint!, eprintln!)?

EDIT: It seems like it is not the same thing. Putting the let in a scope will trigger a compile error in the case of write!.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.