Skip to content

Commit e784712

Browse files
committed
Try to fix a build regression before it happens
1 parent f146711 commit e784712

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/imports.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -309,19 +309,24 @@ impl UseTree {
309309
}
310310
}
311311

312+
let mut done = false;
312313
if aliased_self {
313-
match self.path.last() {
314+
match self.path.last_mut() {
314315
Some(UseSegment::Ident(_, ref mut old_rename)) => {
315316
assert!(old_rename.is_none());
316-
if let UseSegment::Slf(Some(rename)) = last {
317+
if let UseSegment::Slf(Some(rename)) = last.clone() {
317318
*old_rename = Some(rename);
318-
return self;
319+
done = true;
319320
}
320321
}
321322
_ => unreachable!(),
322323
}
323324
}
324325

326+
if done {
327+
return self;
328+
}
329+
325330
// Normalise foo::{bar} -> foo::bar
326331
if let UseSegment::List(ref list) = last {
327332
if list.len() == 1 {

0 commit comments

Comments
 (0)