Get rid of named_pos in format_args impl.

This commit is contained in:
Mara Bos 2022-08-08 15:51:14 +02:00
parent 2808e071dd
commit a639fdb7d8

View File

@ -1316,8 +1316,6 @@ pub fn expand_preparsed_format_args(
.map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end))) .map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end)))
.collect(); .collect();
let named_pos: FxHashSet<usize> = names.values().cloned().collect();
let mut cx = Context { let mut cx = Context {
ecx, ecx,
args, args,
@ -1388,11 +1386,9 @@ pub fn expand_preparsed_format_args(
.enumerate() .enumerate()
.filter(|(i, ty)| ty.is_empty() && !cx.count_positions.contains_key(&i)) .filter(|(i, ty)| ty.is_empty() && !cx.count_positions.contains_key(&i))
.map(|(i, _)| { .map(|(i, _)| {
let msg = if named_pos.contains(&i) { let msg = if cx.args[i].name.is_some() {
// named argument
"named argument never used" "named argument never used"
} else { } else {
// positional argument
"argument never used" "argument never used"
}; };
(cx.args[i].expr.span, msg) (cx.args[i].expr.span, msg)