Flatten if-let and match into one.
This commit is contained in:
parent
15754f5ea1
commit
8d9a5881ea
1 changed files with 14 additions and 19 deletions
|
@ -285,26 +285,21 @@ pub fn make_format_args(
|
||||||
-> FormatArgPosition {
|
-> FormatArgPosition {
|
||||||
let index = match arg {
|
let index = match arg {
|
||||||
Index(index) => {
|
Index(index) => {
|
||||||
if let Some((_, arg_kind)) = args.get(index) {
|
match args.get(index) {
|
||||||
match arg_kind {
|
Some((_, FormatArgKind::Normal)) => {
|
||||||
FormatArgKind::Normal => {
|
used[index] = true;
|
||||||
used[index] = true;
|
Ok(index)
|
||||||
Ok(index)
|
}
|
||||||
}
|
Some((_, FormatArgKind::Named(_))) => {
|
||||||
FormatArgKind::Named(_) => {
|
used[index] = true;
|
||||||
used[index] = true;
|
numeric_refences_to_named_arg.push((index, span, used_as));
|
||||||
numeric_refences_to_named_arg.push((index, span, used_as));
|
Ok(index)
|
||||||
Ok(index)
|
}
|
||||||
}
|
Some((_, FormatArgKind::Captured(_))) | None => {
|
||||||
FormatArgKind::Captured(_) => {
|
// Doesn't exist as an explicit argument.
|
||||||
// Doesn't exist as an explicit argument.
|
invalid_refs.push((index, span, used_as, kind));
|
||||||
invalid_refs.push((index, span, used_as, kind));
|
Err(index)
|
||||||
Err(index)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
invalid_refs.push((index, span, used_as, kind));
|
|
||||||
Err(index)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Name(name, span) => {
|
Name(name, span) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue