Skip to content

Commit

Permalink
Get rid of named_pos in format_args impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Aug 8, 2022
1 parent 2808e07 commit a639fdb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a639fdb

Please sign in to comment.