not to avoid self (#3570)
This commit is contained in:
parent
530086046f
commit
0ef2144c82
@ -478,7 +478,7 @@ impl UseTree {
|
||||
|
||||
// Normalise foo::{bar} -> foo::bar
|
||||
if let UseSegment::List(ref list) = last {
|
||||
if list.len() == 1 {
|
||||
if list.len() == 1 && list[0].to_string() != "self" {
|
||||
normalize_sole_list = true;
|
||||
}
|
||||
}
|
||||
@ -1034,7 +1034,10 @@ mod test {
|
||||
parse_use_tree("a::self as foo").normalize(),
|
||||
parse_use_tree("a as foo")
|
||||
);
|
||||
assert_eq!(parse_use_tree("a::{self}").normalize(), parse_use_tree("a"));
|
||||
assert_eq!(
|
||||
parse_use_tree("a::{self}").normalize(),
|
||||
parse_use_tree("a::{self}")
|
||||
);
|
||||
assert_eq!(parse_use_tree("a::{b}").normalize(), parse_use_tree("a::b"));
|
||||
assert_eq!(
|
||||
parse_use_tree("a::{b, c::self}").normalize(),
|
||||
@ -1069,8 +1072,8 @@ mod test {
|
||||
);
|
||||
|
||||
assert!(
|
||||
parse_use_tree("foo::{self as bar}").normalize()
|
||||
< parse_use_tree("foo::{qux as bar}").normalize()
|
||||
parse_use_tree("foo::{qux as bar}").normalize()
|
||||
< parse_use_tree("foo::{self as bar}").normalize()
|
||||
);
|
||||
assert!(
|
||||
parse_use_tree("foo::{qux as bar}").normalize()
|
||||
|
@ -22,13 +22,13 @@ use list::{
|
||||
|
||||
use test::{/* A */ self /* B */, Other /* C */};
|
||||
|
||||
use syntax;
|
||||
pub use syntax::ast::{Expr, ExprAssign, ExprCall, ExprMethodCall, ExprPath, Expr_};
|
||||
use syntax::{self};
|
||||
use Foo::{Bar, Baz};
|
||||
use {Bar /* comment */, /* Pre-comment! */ Foo};
|
||||
|
||||
use std::io;
|
||||
use std::io;
|
||||
use std::io::{self};
|
||||
|
||||
mod Foo {
|
||||
pub use syntax::ast::{
|
||||
@ -53,8 +53,8 @@ use foo;
|
||||
use foo::bar::baz;
|
||||
|
||||
// With aliases.
|
||||
use foo as bar;
|
||||
use foo::qux as bar;
|
||||
use foo::{self as bar};
|
||||
use foo::{self as bar, baz};
|
||||
use foo::{baz, qux as bar};
|
||||
|
||||
|
1
tests/target/issue-3568.rs
Normal file
1
tests/target/issue-3568.rs
Normal file
@ -0,0 +1 @@
|
||||
use a::b::{self};
|
Loading…
x
Reference in New Issue
Block a user