Skip to content

Commit

Permalink
Use CountIsStart in clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed Aug 31, 2022
1 parent 9a67767 commit 7ed1333
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ impl SimpleFormatArgs {
str_lit_span: Span,
fmt_span: Span,
) {
use rustc_parse_format::{ArgumentImplicitlyIs, ArgumentIs, CountIsParam};
use rustc_parse_format::{ArgumentImplicitlyIs, ArgumentIs, CountIsParam, CountIsStar};

let snippet = snippet_opt(cx, fmt_span);

Expand All @@ -540,7 +540,7 @@ impl SimpleFormatArgs {
self.push_to_complex(span, n);
};

if let (CountIsParam(n), Some(span)) = (arg.format.precision, arg.format.precision_span) {
if let (CountIsParam(n) | CountIsStar(n), Some(span)) = (arg.format.precision, arg.format.precision_span) {
// We need to do this hack as precision spans should be converted from .* to .foo$
let hack = if snippet.as_ref().and_then(|s| s.find('*')).is_some() {
0
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_utils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl<'tcx> Count<'tcx> {
span,
values,
)?),
rpf::Count::CountIsParam(_) => {
rpf::Count::CountIsParam(_) | rpf::Count::CountIsStar(_) => {
Self::Param(FormatParam::new(FormatParamKind::Numbered, position?, inner?, values)?)
},
rpf::Count::CountImplied => Self::Implied,
Expand Down

0 comments on commit 7ed1333

Please sign in to comment.