Skip to content

Commit 8d9a588

Browse files
committed
Flatten if-let and match into one.
1 parent 15754f5 commit 8d9a588

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -285,26 +285,21 @@ pub fn make_format_args(
285285
-> FormatArgPosition {
286286
let index = match arg {
287287
Index(index) => {
288-
if let Some((_, arg_kind)) = args.get(index) {
289-
match arg_kind {
290-
FormatArgKind::Normal => {
291-
used[index] = true;
292-
Ok(index)
293-
}
294-
FormatArgKind::Named(_) => {
295-
used[index] = true;
296-
numeric_refences_to_named_arg.push((index, span, used_as));
297-
Ok(index)
298-
}
299-
FormatArgKind::Captured(_) => {
300-
// Doesn't exist as an explicit argument.
301-
invalid_refs.push((index, span, used_as, kind));
302-
Err(index)
303-
}
288+
match args.get(index) {
289+
Some((_, FormatArgKind::Normal)) => {
290+
used[index] = true;
291+
Ok(index)
292+
}
293+
Some((_, FormatArgKind::Named(_))) => {
294+
used[index] = true;
295+
numeric_refences_to_named_arg.push((index, span, used_as));
296+
Ok(index)
297+
}
298+
Some((_, FormatArgKind::Captured(_))) | None => {
299+
// Doesn't exist as an explicit argument.
300+
invalid_refs.push((index, span, used_as, kind));
301+
Err(index)
304302
}
305-
} else {
306-
invalid_refs.push((index, span, used_as, kind));
307-
Err(index)
308303
}
309304
}
310305
Name(name, span) => {

0 commit comments

Comments
 (0)