Merge pull request #144 from marcusklaas/single-use
Format simple imports
This commit is contained in:
commit
ed889e01db
3 changed files with 18 additions and 2 deletions
|
@ -37,8 +37,14 @@ impl Rewrite for ast::ViewPath {
|
||||||
// FIXME convert to list?
|
// FIXME convert to list?
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
ast::ViewPath_::ViewPathSimple(_,_) => {
|
ast::ViewPath_::ViewPathSimple(ident, ref path) => {
|
||||||
None
|
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 Baz::*;
|
||||||
use Qux;
|
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 Baz::*;
|
||||||
use Qux;
|
use Qux;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple imports
|
||||||
|
use foo::bar::baz;
|
||||||
|
use bar::quux as kaas;
|
||||||
|
use foo;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue