Skip to content

Commit

Permalink
Delete an unreachable codepath from format_args implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 28, 2021
1 parent e6d2de9 commit cc53f13
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ struct Context<'a, 'b> {
/// * Implicit argument resolution: `"{1:.0$} {2:.foo$} {1:.3$} {4:.0$}"`
/// * Name resolution: `"{1:.0$} {2:.5$} {1:.3$} {4:.0$}"`
/// * `count_positions` (in JSON): `{0: 0, 5: 1, 3: 2}`
/// * `count_args`: `vec![Exact(0), Exact(5), Exact(3)]`
count_args: Vec<Position>,
/// * `count_args`: `vec![0, 5, 3]`
count_args: Vec<usize>,
/// Relative slot numbers for count arguments.
count_positions: FxHashMap<usize, usize>,
/// Number of count slots assigned.
Expand Down Expand Up @@ -513,7 +513,7 @@ impl<'a, 'b> Context<'a, 'b> {
if let Entry::Vacant(e) = self.count_positions.entry(arg) {
let i = self.count_positions_count;
e.insert(i);
self.count_args.push(Exact(arg));
self.count_args.push(arg);
self.count_positions_count += 1;
}
}
Expand Down Expand Up @@ -771,11 +771,7 @@ impl<'a, 'b> Context<'a, 'b> {
}
heads.push(self.ecx.expr_addr_of(e.span, e));
}
for pos in self.count_args {
let index = match pos {
Exact(i) => i,
_ => panic!("should never happen"),
};
for index in self.count_args {
let span = spans_pos[index];
args.push(Context::format_arg(self.ecx, self.macsp, span, &Count, index));
}
Expand Down

0 comments on commit cc53f13

Please sign in to comment.