Use CountIsStart
in clippy
This commit is contained in:
parent
fb41bfa774
commit
7bd5b012c7
@ -526,7 +526,7 @@ impl SimpleFormatArgs {
|
|||||||
str_lit_span: Span,
|
str_lit_span: Span,
|
||||||
fmt_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);
|
let snippet = snippet_opt(cx, fmt_span);
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ impl SimpleFormatArgs {
|
|||||||
self.push_to_complex(span, n);
|
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$
|
// 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() {
|
let hack = if snippet.as_ref().and_then(|s| s.find('*')).is_some() {
|
||||||
0
|
0
|
||||||
|
@ -644,7 +644,7 @@ impl<'tcx> Count<'tcx> {
|
|||||||
span,
|
span,
|
||||||
values,
|
values,
|
||||||
)?),
|
)?),
|
||||||
rpf::Count::CountIsParam(_) => {
|
rpf::Count::CountIsParam(_) | rpf::Count::CountIsStar(_) => {
|
||||||
Self::Param(FormatParam::new(FormatParamKind::Numbered, position?, inner?, values)?)
|
Self::Param(FormatParam::new(FormatParamKind::Numbered, position?, inner?, values)?)
|
||||||
},
|
},
|
||||||
rpf::Count::CountImplied => Self::Implied,
|
rpf::Count::CountImplied => Self::Implied,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user