mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 09:04:18 +00:00
Add clarifying comments.
This commit is contained in:
parent
8d9a5881ea
commit
c1c6e3ae7c
@ -308,12 +308,15 @@ pub fn make_format_args(
|
|||||||
.iter()
|
.iter()
|
||||||
.position(|arg| arg.1.ident().is_some_and(|id| id.name == name))
|
.position(|arg| arg.1.ident().is_some_and(|id| id.name == name))
|
||||||
{
|
{
|
||||||
|
// Name found in `args`, so we resolve it to its index in that Vec.
|
||||||
let index = start_of_named_args + i;
|
let index = start_of_named_args + i;
|
||||||
if !matches!(args[index].1, FormatArgKind::Captured(_)) {
|
if !matches!(args[index].1, FormatArgKind::Captured(_)) {
|
||||||
|
// Mark it as used, if it was an explicit argument.
|
||||||
used[index] = true;
|
used[index] = true;
|
||||||
}
|
}
|
||||||
Ok(index)
|
Ok(index)
|
||||||
} else {
|
} else {
|
||||||
|
// Name not found in `args`, so we add it as an implicitly captured argument.
|
||||||
let span = span.unwrap_or(fmt_span);
|
let span = span.unwrap_or(fmt_span);
|
||||||
let ident = Ident::new(name, span);
|
let ident = Ident::new(name, span);
|
||||||
let arg = if is_literal {
|
let arg = if is_literal {
|
||||||
|
Loading…
Reference in New Issue
Block a user