Skip to content

Move uninlined_format_args back to style #14160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clippy_lints/src/format_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ declare_clippy_lint! {
/// format!("{var:.prec$}");
/// ```
///
/// If allow-mixed-uninlined-format-args is set to false in clippy.toml,
/// If `allow-mixed-uninlined-format-args` is set to `false` in clippy.toml,
/// the following code will also trigger the lint:
/// ```no_run
/// # let var = 42;
Expand All @@ -159,7 +159,7 @@ declare_clippy_lint! {
/// nothing will be suggested, e.g. `println!("{0}={1}", var, 1+2)`.
#[clippy::version = "1.66.0"]
pub UNINLINED_FORMAT_ARGS,
pedantic,
style,
"using non-inlined variables in `format!` calls"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::uninlined_format_args)]
#![deny(clippy::index_refutable_slice)]

fn below_limit() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::uninlined_format_args)]
#![deny(clippy::index_refutable_slice)]

fn below_limit() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: this binding can be a slice pattern to avoid indexing
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:5:17
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:6:17
|
LL | if let Some(slice) = slice {
| ^^^^^
|
note: the lint level is defined here
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:1:9
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:2:9
|
LL | #![deny(clippy::index_refutable_slice)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/author/macro_in_closure.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ check-pass

#![allow(clippy::uninlined_format_args)]

fn main() {
#[clippy::author]
let print_text = |x| println!("{}", x);
Expand Down
1 change: 1 addition & 0 deletions tests/ui/author/macro_in_loop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ check-pass

#![feature(stmt_expr_attributes)]
#![allow(clippy::uninlined_format_args)]

fn main() {
#[clippy::author]
Expand Down
7 changes: 6 additions & 1 deletion tests/ui/dbg_macro/dbg_macro.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#![allow(
clippy::no_effect,
clippy::uninlined_format_args,
clippy::unit_arg,
clippy::unnecessary_operation
)]
#![warn(clippy::dbg_macro)]
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]

fn foo(n: u32) -> u32 {
if let Some(n) = n.checked_sub(4) { n } else { n }
Expand Down
7 changes: 6 additions & 1 deletion tests/ui/dbg_macro/dbg_macro.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#![allow(
clippy::no_effect,
clippy::uninlined_format_args,
clippy::unit_arg,
clippy::unnecessary_operation
)]
#![warn(clippy::dbg_macro)]
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]

fn foo(n: u32) -> u32 {
if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
Expand Down
38 changes: 19 additions & 19 deletions tests/ui/dbg_macro/dbg_macro.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:5:22
--> tests/ui/dbg_macro/dbg_macro.rs:10:22
|
LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
| ^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -13,7 +13,7 @@ LL + if let Some(n) = n.checked_sub(4) { n } else { n }
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:11:8
--> tests/ui/dbg_macro/dbg_macro.rs:16:8
|
LL | if dbg!(n <= 1) {
| ^^^^^^^^^^^^
Expand All @@ -25,7 +25,7 @@ LL + if n <= 1 {
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:14:9
--> tests/ui/dbg_macro/dbg_macro.rs:19:9
|
LL | dbg!(1)
| ^^^^^^^
Expand All @@ -37,7 +37,7 @@ LL + 1
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:17:9
--> tests/ui/dbg_macro/dbg_macro.rs:22:9
|
LL | dbg!(n * factorial(n - 1))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -49,7 +49,7 @@ LL + n * factorial(n - 1)
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:23:5
--> tests/ui/dbg_macro/dbg_macro.rs:28:5
|
LL | dbg!(42);
| ^^^^^^^^
Expand All @@ -61,7 +61,7 @@ LL + 42;
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:26:14
--> tests/ui/dbg_macro/dbg_macro.rs:31:14
|
LL | foo(3) + dbg!(factorial(4));
| ^^^^^^^^^^^^^^^^^^
Expand All @@ -73,7 +73,7 @@ LL + foo(3) + factorial(4);
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:29:5
--> tests/ui/dbg_macro/dbg_macro.rs:34:5
|
LL | dbg!(1, 2, 3, 4, 5);
| ^^^^^^^^^^^^^^^^^^^
Expand All @@ -85,7 +85,7 @@ LL + (1, 2, 3, 4, 5);
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:51:5
--> tests/ui/dbg_macro/dbg_macro.rs:56:5
|
LL | dbg!();
| ^^^^^^
Expand All @@ -96,7 +96,7 @@ LL - dbg!();
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:55:13
--> tests/ui/dbg_macro/dbg_macro.rs:60:13
|
LL | let _ = dbg!();
| ^^^^^^
Expand All @@ -108,7 +108,7 @@ LL + let _ = ();
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:58:9
--> tests/ui/dbg_macro/dbg_macro.rs:63:9
|
LL | bar(dbg!());
| ^^^^^^
Expand All @@ -120,7 +120,7 @@ LL + bar(());
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:61:10
--> tests/ui/dbg_macro/dbg_macro.rs:66:10
|
LL | foo!(dbg!());
| ^^^^^^
Expand All @@ -132,7 +132,7 @@ LL + foo!(());
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:64:16
--> tests/ui/dbg_macro/dbg_macro.rs:69:16
|
LL | foo2!(foo!(dbg!()));
| ^^^^^^
Expand All @@ -144,7 +144,7 @@ LL + foo2!(foo!(()));
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:46:13
--> tests/ui/dbg_macro/dbg_macro.rs:51:13
|
LL | dbg!();
| ^^^^^^
Expand All @@ -159,7 +159,7 @@ LL - dbg!();
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:87:9
--> tests/ui/dbg_macro/dbg_macro.rs:92:9
|
LL | dbg!(2);
| ^^^^^^^
Expand All @@ -171,7 +171,7 @@ LL + 2;
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:94:5
--> tests/ui/dbg_macro/dbg_macro.rs:99:5
|
LL | dbg!(1);
| ^^^^^^^
Expand All @@ -183,7 +183,7 @@ LL + 1;
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:100:5
--> tests/ui/dbg_macro/dbg_macro.rs:105:5
|
LL | dbg!(1);
| ^^^^^^^
Expand All @@ -195,7 +195,7 @@ LL + 1;
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:107:9
--> tests/ui/dbg_macro/dbg_macro.rs:112:9
|
LL | dbg!(1);
| ^^^^^^^
Expand All @@ -207,7 +207,7 @@ LL + 1;
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:114:31
--> tests/ui/dbg_macro/dbg_macro.rs:119:31
|
LL | println!("dbg: {:?}", dbg!(s));
| ^^^^^^^
Expand All @@ -219,7 +219,7 @@ LL + println!("dbg: {:?}", s);
|

error: the `dbg!` macro is intended as a debugging tool
--> tests/ui/dbg_macro/dbg_macro.rs:117:22
--> tests/ui/dbg_macro/dbg_macro.rs:122:22
|
LL | print!("{}", dbg!(s));
| ^^^^^^^
Expand Down
9 changes: 6 additions & 3 deletions tests/ui/large_futures.fixed
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![allow(
clippy::future_not_send,
clippy::manual_async_fn,
clippy::never_loop,
clippy::uninlined_format_args
)]
#![warn(clippy::large_futures)]
#![allow(clippy::never_loop)]
#![allow(clippy::future_not_send)]
#![allow(clippy::manual_async_fn)]

async fn big_fut(_arg: [u8; 1024 * 16]) {}

Expand Down
9 changes: 6 additions & 3 deletions tests/ui/large_futures.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![allow(
clippy::future_not_send,
clippy::manual_async_fn,
clippy::never_loop,
clippy::uninlined_format_args
)]
#![warn(clippy::large_futures)]
#![allow(clippy::never_loop)]
#![allow(clippy::future_not_send)]
#![allow(clippy::manual_async_fn)]

async fn big_fut(_arg: [u8; 1024 * 16]) {}

Expand Down
16 changes: 8 additions & 8 deletions tests/ui/large_futures.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: large future with a size of 16385 bytes
--> tests/ui/large_futures.rs:10:9
--> tests/ui/large_futures.rs:13:9
|
LL | big_fut([0u8; 1024 * 16]).await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(big_fut([0u8; 1024 * 16]))`
Expand All @@ -8,37 +8,37 @@ LL | big_fut([0u8; 1024 * 16]).await;
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`

error: large future with a size of 16386 bytes
--> tests/ui/large_futures.rs:13:5
--> tests/ui/large_futures.rs:16:5
|
LL | f.await
| ^ help: consider `Box::pin` on it: `Box::pin(f)`

error: large future with a size of 16387 bytes
--> tests/ui/large_futures.rs:18:9
--> tests/ui/large_futures.rs:21:9
|
LL | wait().await;
| ^^^^^^ help: consider `Box::pin` on it: `Box::pin(wait())`

error: large future with a size of 16387 bytes
--> tests/ui/large_futures.rs:24:13
--> tests/ui/large_futures.rs:27:13
|
LL | wait().await;
| ^^^^^^ help: consider `Box::pin` on it: `Box::pin(wait())`

error: large future with a size of 65540 bytes
--> tests/ui/large_futures.rs:32:5
--> tests/ui/large_futures.rs:35:5
|
LL | foo().await;
| ^^^^^ help: consider `Box::pin` on it: `Box::pin(foo())`

error: large future with a size of 49159 bytes
--> tests/ui/large_futures.rs:35:5
--> tests/ui/large_futures.rs:38:5
|
LL | calls_fut(fut).await;
| ^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(calls_fut(fut))`

error: large future with a size of 65540 bytes
--> tests/ui/large_futures.rs:48:5
--> tests/ui/large_futures.rs:51:5
|
LL | / async {
LL | |
Expand All @@ -61,7 +61,7 @@ LL + })
|

error: large future with a size of 65540 bytes
--> tests/ui/large_futures.rs:61:13
--> tests/ui/large_futures.rs:64:13
|
LL | / async {
LL | |
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/manual_inspect.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]
#![warn(clippy::manual_inspect)]
#![allow(clippy::no_effect, clippy::op_ref)]

fn main() {
let _ = Some(0).inspect(|&x| {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/manual_inspect.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]
#![warn(clippy::manual_inspect)]
#![allow(clippy::no_effect, clippy::op_ref)]

fn main() {
let _ = Some(0).map(|x| {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/manual_strip_fixable.fixed
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::manual_strip)]
#![allow(clippy::uninlined_format_args)]

fn main() {
let s = "abc";
Expand Down
1 change: 1 addition & 0 deletions tests/ui/manual_strip_fixable.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::manual_strip)]
#![allow(clippy::uninlined_format_args)]

fn main() {
let s = "abc";
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/manual_strip_fixable.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: stripping a prefix manually
--> tests/ui/manual_strip_fixable.rs:7:24
--> tests/ui/manual_strip_fixable.rs:8:24
|
LL | let stripped = &s["ab".len()..];
| ^^^^^^^^^^^^^^^^
|
note: the prefix was tested here
--> tests/ui/manual_strip_fixable.rs:6:5
--> tests/ui/manual_strip_fixable.rs:7:5
|
LL | if s.starts_with("ab") {
| ^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -19,13 +19,13 @@ LL ~ println!("{stripped}{}", stripped);
|

error: stripping a suffix manually
--> tests/ui/manual_strip_fixable.rs:13:24
--> tests/ui/manual_strip_fixable.rs:14:24
|
LL | let stripped = &s[..s.len() - "bc".len()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the suffix was tested here
--> tests/ui/manual_strip_fixable.rs:12:5
--> tests/ui/manual_strip_fixable.rs:13:5
|
LL | if s.ends_with("bc") {
| ^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading