Imports [FIXME: needs RFC]

The imports of a crate/module should consist of the following sections, in order, with a blank space between each:

For example:

fn main() { // Crates. extern crate getopts; extern crate mylib; // Standard library imports. use getopts::{optopt, getopts}; use std::os; // Import from a library that we wrote. use mylib::webserver; // Will be reexported when we import this module. pub use self::types::Webdata; }
// Crates.
extern crate getopts;
extern crate mylib;

// Standard library imports.
use getopts::{optopt, getopts};
use std::os;

// Import from a library that we wrote.
use mylib::webserver;

// Will be reexported when we import this module.
pub use self::types::Webdata;

Avoid use *, except in tests.

Glob imports have several downsides: * They make it harder to tell where names are bound. * They are forwards-incompatible, since new upstream exports can clash with existing names.

When writing a test submodule, importing super::* is appropriate as a convenience.

Prefer fully importing types/traits while module-qualifying functions.

For example:

fn main() { use option::Option; use mem; let i: int = mem::transmute(Option(0)); }
use option::Option;
use mem;

let i: int = mem::transmute(Option(0));

[FIXME] Add rationale.