Skip to content

Commit

Permalink
Try to fix a build regression before it happens
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Apr 9, 2018
1 parent f146711 commit e784712
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,24 @@ impl UseTree {
}
}

let mut done = false;
if aliased_self {
match self.path.last() {
match self.path.last_mut() {
Some(UseSegment::Ident(_, ref mut old_rename)) => {
assert!(old_rename.is_none());
if let UseSegment::Slf(Some(rename)) = last {
if let UseSegment::Slf(Some(rename)) = last.clone() {
*old_rename = Some(rename);
return self;
done = true;
}
}
_ => unreachable!(),
}
}

if done {
return self;
}

// Normalise foo::{bar} -> foo::bar
if let UseSegment::List(ref list) = last {
if list.len() == 1 {
Expand Down

0 comments on commit e784712

Please sign in to comment.