Skip to content

Commit

Permalink
uninlined_format_args: do not inline argument with generic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Feb 15, 2023
1 parent 0e40f94 commit 75aa2b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions clippy_lints/src/format_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ fn check_one_arg(
if matches!(param.kind, Implicit | Starred | Named(_) | Numbered)
&& let ExprKind::Path(QPath::Resolved(None, path)) = param.value.kind
&& let [segment] = path.segments
&& segment.args.is_none()
&& let Some(arg_span) = args.value_with_prev_comma_span(param.value.hir_id)
{
let replacement = match param.usage {
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/uninlined_format_args.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,7 @@ fn _meets_msrv() {
let local_i32 = 1;
println!("expand='{local_i32}'");
}

fn _do_not_fire() {
println!("{:?}", None::<()>);
}
4 changes: 4 additions & 0 deletions tests/ui/uninlined_format_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ fn _meets_msrv() {
let local_i32 = 1;
println!("expand='{}'", local_i32);
}

fn _do_not_fire() {
println!("{:?}", None::<()>);
}

0 comments on commit 75aa2b9

Please sign in to comment.