Merge pull request #144 from marcusklaas/single-use
Format simple imports
This commit is contained in:
commit
ed889e01db
@ -37,8 +37,14 @@ impl Rewrite for ast::ViewPath {
|
||||
// FIXME convert to list?
|
||||
None
|
||||
}
|
||||
ast::ViewPath_::ViewPathSimple(_,_) => {
|
||||
None
|
||||
ast::ViewPath_::ViewPathSimple(ident, ref path) => {
|
||||
let path_str = pprust::path_to_string(path);
|
||||
|
||||
Some(if path.segments.last().unwrap().identifier == ident {
|
||||
path_str
|
||||
} else {
|
||||
format!("{} as {}", path_str, ident)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,3 +39,8 @@ fn test() {
|
||||
use Baz::*;
|
||||
use Qux;
|
||||
}
|
||||
|
||||
// Simple imports
|
||||
use foo::bar::baz as baz ;
|
||||
use bar::quux as kaas;
|
||||
use foo;
|
||||
|
@ -32,3 +32,8 @@ fn test() {
|
||||
use Baz::*;
|
||||
use Qux;
|
||||
}
|
||||
|
||||
// Simple imports
|
||||
use foo::bar::baz;
|
||||
use bar::quux as kaas;
|
||||
use foo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user