Skip to content

Commit 75aa2b9

Browse files
committed
uninlined_format_args: do not inline argument with generic parameters
1 parent 0e40f94 commit 75aa2b9

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

clippy_lints/src/format_args.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ fn check_one_arg(
340340
if matches!(param.kind, Implicit | Starred | Named(_) | Numbered)
341341
&& let ExprKind::Path(QPath::Resolved(None, path)) = param.value.kind
342342
&& let [segment] = path.segments
343+
&& segment.args.is_none()
343344
&& let Some(arg_span) = args.value_with_prev_comma_span(param.value.hir_id)
344345
{
345346
let replacement = match param.usage {

tests/ui/uninlined_format_args.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,7 @@ fn _meets_msrv() {
174174
let local_i32 = 1;
175175
println!("expand='{local_i32}'");
176176
}
177+
178+
fn _do_not_fire() {
179+
println!("{:?}", None::<()>);
180+
}

tests/ui/uninlined_format_args.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,7 @@ fn _meets_msrv() {
179179
let local_i32 = 1;
180180
println!("expand='{}'", local_i32);
181181
}
182+
183+
fn _do_not_fire() {
184+
println!("{:?}", None::<()>);
185+
}

0 commit comments

Comments
 (0)