rust-clippy/clippy_utils/src
Yuri Astrakhan 5a71bbdf3f new uninlined_format_args lint to inline explicit arguments
Implement https://github.com/rust-lang/rust-clippy/issues/8368 - a new
lint to inline format arguments such as `print!("{}", var)` into
`print!("{var}")`.

code | suggestion | comment
---|---|---
`print!("{}", var)` | `print!("{var}")` |  simple variables
`print!("{0}", var)` | `print!("{var}")` |  positional variables
`print!("{v}", v=var)` | `print!("{var}")` |  named variables
`print!("{0} {0}", var)` | `print!("{var} {var}")` |  aliased variables
`print!("{0:1$}", var, width)` | `print!("{var:width$}")` |  width
support
`print!("{0:.1$}", var, prec)` | `print!("{var:.prec$}")` |  precision
support
`print!("{:.*}", prec, var)` | `print!("{var:.prec$}")` |  asterisk
support

code | suggestion | comment
---|---|---
`print!("{0}={1}", var, 1+2)` | `print!("{var}={0}", 1+2)` | Format
string uses an indexed argument that cannot be inlined.  Supporting this
case requires re-indexing of the format string.

changelog: [`uninlined_format_args`]: A new lint to inline format
arguments, i.e. `print!("{}", var)` into `print!("{var}")`
2022-09-25 19:53:03 -04:00
..
ast_utils Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup 2021-02-25 11:25:22 +01:00
ast_utils.rs Shrink ast::Attribute. 2022-08-16 11:10:13 +10:00
attrs.rs and a few more from other dirs 2022-09-23 14:25:03 -04:00
check_proc_macro.rs Merge remote-tracking branch 'upstream/auto' into rustup 2022-09-08 21:27:09 +02:00
comparisons.rs Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup 2021-02-25 11:25:22 +01:00
consts.rs Don't panic on invalid shift while constfolding 2022-09-11 12:26:13 +02:00
diagnostics.rs and a few more from other dirs 2022-09-23 14:25:03 -04:00
eager_or_lazy.rs Merge remote-tracking branch 'upstream/auto' into rustup 2022-09-08 21:27:09 +02:00
higher.rs Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyup 2022-06-04 13:34:07 +02:00
hir_utils.rs Merge remote-tracking branch 'upstream/auto' into rustup 2022-09-08 21:27:09 +02:00
lib.rs and a few more from other dirs 2022-09-23 14:25:03 -04:00
macros.rs new uninlined_format_args lint to inline explicit arguments 2022-09-25 19:53:03 -04:00
msrvs.rs new uninlined_format_args lint to inline explicit arguments 2022-09-25 19:53:03 -04:00
numeric_literal.rs Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup 2022-08-11 19:42:16 +02:00
paths.rs Merge commit 'f51aade56f93175dde89177a92e3669ebd8e7592' into clippyup 2022-08-31 09:24:45 -04:00
ptr.rs separate the receiver from arguments in HIR under /clippy 2022-09-05 22:25:57 +09:00
qualify_min_const_fn.rs and a few more from other dirs 2022-09-23 14:25:03 -04:00
source.rs new uninlined_format_args lint to inline explicit arguments 2022-09-25 19:53:03 -04:00
str_utils.rs Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup 2021-12-30 15:10:43 +01:00
sugg.rs and a few more from other dirs 2022-09-23 14:25:03 -04:00
sym_helper.rs Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup 2021-02-25 11:25:22 +01:00
ty.rs refactor: move has_debug_impl to clippy_utils::ty 2022-09-10 10:39:51 +02:00
usage.rs Make ExprKind::Closure a struct variant. 2022-06-12 00:16:27 +02:00
visitors.rs Merge remote-tracking branch 'upstream/auto' into rustup 2022-09-08 21:27:09 +02:00