diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2022-08-08 15:51:14 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2022-08-08 15:51:14 +0200 |
| commit | a639fdb7d89e7acb8ca3e158ecf72c27ad525518 (patch) | |
| tree | 64478428fbb12ab4d391363293ea04512ec05f59 | |
| parent | 2808e071dd5042e839749f9d5f794dc0896d1bfd (diff) | |
| download | rust-a639fdb7d89e7acb8ca3e158ecf72c27ad525518.tar.gz rust-a639fdb7d89e7acb8ca3e158ecf72c27ad525518.zip | |
Get rid of named_pos in format_args impl.
| -rw-r--r-- | compiler/rustc_builtin_macros/src/format.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index d96f24c7bc7..53c13873b10 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -1316,8 +1316,6 @@ pub fn expand_preparsed_format_args( .map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end))) .collect(); - let named_pos: FxHashSet<usize> = names.values().cloned().collect(); - let mut cx = Context { ecx, args, @@ -1388,11 +1386,9 @@ pub fn expand_preparsed_format_args( .enumerate() .filter(|(i, ty)| ty.is_empty() && !cx.count_positions.contains_key(&i)) .map(|(i, _)| { - let msg = if named_pos.contains(&i) { - // named argument + let msg = if cx.args[i].name.is_some() { "named argument never used" } else { - // positional argument "argument never used" }; (cx.args[i].expr.span, msg) |
