Skip to content

Commit 7df49ef

Browse files
authored
Rollup merge of #91327 - dtolnay:exact, r=michaelwoerister
Delete an unreachable codepath from format_args implementation
2 parents a2f924a + cc53f13 commit 7df49ef

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ struct Context<'a, 'b> {
8888
/// * Implicit argument resolution: `"{1:.0$} {2:.foo$} {1:.3$} {4:.0$}"`
8989
/// * Name resolution: `"{1:.0$} {2:.5$} {1:.3$} {4:.0$}"`
9090
/// * `count_positions` (in JSON): `{0: 0, 5: 1, 3: 2}`
91-
/// * `count_args`: `vec![Exact(0), Exact(5), Exact(3)]`
92-
count_args: Vec<Position>,
91+
/// * `count_args`: `vec![0, 5, 3]`
92+
count_args: Vec<usize>,
9393
/// Relative slot numbers for count arguments.
9494
count_positions: FxHashMap<usize, usize>,
9595
/// Number of count slots assigned.
@@ -513,7 +513,7 @@ impl<'a, 'b> Context<'a, 'b> {
513513
if let Entry::Vacant(e) = self.count_positions.entry(arg) {
514514
let i = self.count_positions_count;
515515
e.insert(i);
516-
self.count_args.push(Exact(arg));
516+
self.count_args.push(arg);
517517
self.count_positions_count += 1;
518518
}
519519
}
@@ -774,11 +774,7 @@ impl<'a, 'b> Context<'a, 'b> {
774774
// (the span is otherwise unavailable in MIR)
775775
heads.push(self.ecx.expr_addr_of(e.span.with_ctxt(self.macsp.ctxt()), e));
776776
}
777-
for pos in self.count_args {
778-
let index = match pos {
779-
Exact(i) => i,
780-
_ => panic!("should never happen"),
781-
};
777+
for index in self.count_args {
782778
let span = spans_pos[index];
783779
args.push(Context::format_arg(self.ecx, self.macsp, span, &Count, index));
784780
}

0 commit comments

Comments
 (0)