diff options
| author | Yuri Astrakhan <YuriAstrakhan@gmail.com> | 2024-07-19 16:10:24 -0400 |
|---|---|---|
| committer | Yuri Astrakhan <YuriAstrakhan@gmail.com> | 2024-07-19 16:10:24 -0400 |
| commit | 266abf3c08203d0ae7bf6d0ba18db5a6df2fd1c2 (patch) | |
| tree | ffd5fbc2ebf4c8e564f9827edd0d4c01114c3fd7 /clippy_lints/src/default.rs | |
| parent | 057c4ae28766613da5b6578fa13d2412604b633b (diff) | |
Avoid ref when using format!
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing).
Inlining format args prevents accidental `&` misuse.
Diffstat (limited to 'clippy_lints/src/default.rs')
| -rw-r--r-- | clippy_lints/src/default.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/default.rs b/clippy_lints/src/default.rs index 72fa05be3cc..0b7279f2b36 100644 --- a/clippy_lints/src/default.rs +++ b/clippy_lints/src/default.rs @@ -221,7 +221,7 @@ impl<'tcx> LateLintPass<'tcx> for Default { .map(ToString::to_string) .collect::<Vec<_>>() .join(", "); - format!("{adt_def_ty_name}::<{}>", &tys_str) + format!("{adt_def_ty_name}::<{tys_str}>") } else { binding_type.to_string() }; |
