Skip to content

Commit 0c6d1f3

Browse files
committed
syntax: update pretty-printer for the <T>::method shorthand.
1 parent 72d5f39 commit 0c6d1f3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/libsyntax/print/pprust.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -2048,9 +2048,12 @@ impl<'a> State<'a> {
20482048
{
20492049
try!(word(&mut self.s, "<"));
20502050
try!(self.print_type(&qself.ty));
2051-
try!(space(&mut self.s));
2052-
try!(self.word_space("as"));
2053-
try!(self.print_path(&path, false, 1));
2051+
if qself.position > 0 {
2052+
try!(space(&mut self.s));
2053+
try!(self.word_space("as"));
2054+
let depth = path.segments.len() - qself.position;
2055+
try!(self.print_path(&path, false, depth));
2056+
}
20542057
try!(word(&mut self.s, ">"));
20552058
try!(word(&mut self.s, "::"));
20562059
let item_segment = path.segments.last().unwrap();

0 commit comments

Comments
 (0)