about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2022-08-31 09:33:32 -0400
committerJason Newcomb <jsnewcomb@pm.me>2022-08-31 09:45:51 -0400
commit7ed133324ad029ca5a0ecdb636f63fdf315c4381 (patch)
tree4e0eed718776b34af816b9cd06f42b20d190d75a
parent9a677674b3364cab71fd49793aa5cc90b9dc5322 (diff)
downloadrust-7ed133324ad029ca5a0ecdb636f63fdf315c4381.tar.gz
rust-7ed133324ad029ca5a0ecdb636f63fdf315c4381.zip
Use `CountIsStart` in clippy
-rw-r--r--src/tools/clippy/clippy_lints/src/write.rs4
-rw-r--r--src/tools/clippy/clippy_utils/src/macros.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/clippy/clippy_lints/src/write.rs b/src/tools/clippy/clippy_lints/src/write.rs
index 5533840b166..347165d9704 100644
--- a/src/tools/clippy/clippy_lints/src/write.rs
+++ b/src/tools/clippy/clippy_lints/src/write.rs
@@ -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);
 
@@ -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
diff --git a/src/tools/clippy/clippy_utils/src/macros.rs b/src/tools/clippy/clippy_utils/src/macros.rs
index e5ca3545540..43e53f3feeb 100644
--- a/src/tools/clippy/clippy_utils/src/macros.rs
+++ b/src/tools/clippy/clippy_utils/src/macros.rs
@@ -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,