Where is the recommended place to put use
declarations? I couldn't find any decisive answer in the book, in FAQs, mailing lists or online forums. I'm beginning a new project in Rust and I'd prefer to get the right approach right away.
Is one of the two below approaches recommended? Is it only for "aliasing" stuff or does it do more, like initialize a module if it hasn't been used before?
use std::io;
use std::io::Write;
fn some_func() -> () {
[...] // We assume we need std::io here
}
fn some_other_func() -> () {
[...] // We assume we need std::io and std::io::Write here
}
OR
fn some_func() -> () {
use std::io;
[...] // We assume we need std::io here
}
fn some_other_func() -> () {
use std::io;
use std::io::Write;
[...] // We assume we need std::io and std::io::Write here
}