When I try to use the writeln!() on a file, it looks like the macro forgot to include the appropriate import?
Compiling hello v0.0.1 (/src)
error[E0599]: no method named `write_fmt` found for type `std::fs::File` in the current scope
--> hello.rs:8:5
|
8 | writeln!(file, "Hello World!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
3 | use std::io::Write;
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `hello`.
Could we add use std::io::Write; inside the macro?