Skip to content

Commit a001ae3

Browse files
authored
Move uninlined_format_args back to style (#14160)
The `uninlined_format_args` was temporarily downgraded to `pedantic` in part because rust-analyzer was not fully supporting it at the time, per #10087. The support has been added over [a year ago](rust-lang/rust-analyzer#11260), so seems like this should be back to style. Another source of the initial frustration was fixed since then as well - this lint does not trigger by default in case only some arguments can be inlined. changelog: [`uninlined_format_args`]: move back to `style`
2 parents d95bdcf + 1ca79a8 commit a001ae3

34 files changed

+251
-217
lines changed

clippy_lints/src/format_args.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ declare_clippy_lint! {
141141
/// format!("{var:.prec$}");
142142
/// ```
143143
///
144-
/// If allow-mixed-uninlined-format-args is set to false in clippy.toml,
144+
/// If `allow-mixed-uninlined-format-args` is set to `false` in clippy.toml,
145145
/// the following code will also trigger the lint:
146146
/// ```no_run
147147
/// # let var = 42;
@@ -159,7 +159,7 @@ declare_clippy_lint! {
159159
/// nothing will be suggested, e.g. `println!("{0}={1}", var, 1+2)`.
160160
#[clippy::version = "1.66.0"]
161161
pub UNINLINED_FORMAT_ARGS,
162-
pedantic,
162+
style,
163163
"using non-inlined variables in `format!` calls"
164164
}
165165

tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::uninlined_format_args)]
12
#![deny(clippy::index_refutable_slice)]
23

34
fn below_limit() {

tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::uninlined_format_args)]
12
#![deny(clippy::index_refutable_slice)]
23

34
fn below_limit() {

tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: this binding can be a slice pattern to avoid indexing
2-
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:5:17
2+
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:6:17
33
|
44
LL | if let Some(slice) = slice {
55
| ^^^^^
66
|
77
note: the lint level is defined here
8-
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:1:9
8+
--> tests/ui-toml/max_suggested_slice_pattern_length/index_refutable_slice.rs:2:9
99
|
1010
LL | #![deny(clippy::index_refutable_slice)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/author/macro_in_closure.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ check-pass
22

3+
#![allow(clippy::uninlined_format_args)]
4+
35
fn main() {
46
#[clippy::author]
57
let print_text = |x| println!("{}", x);

tests/ui/author/macro_in_loop.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ check-pass
22

33
#![feature(stmt_expr_attributes)]
4+
#![allow(clippy::uninlined_format_args)]
45

56
fn main() {
67
#[clippy::author]

tests/ui/dbg_macro/dbg_macro.fixed

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
#![allow(
2+
clippy::no_effect,
3+
clippy::uninlined_format_args,
4+
clippy::unit_arg,
5+
clippy::unnecessary_operation
6+
)]
17
#![warn(clippy::dbg_macro)]
2-
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]
38

49
fn foo(n: u32) -> u32 {
510
if let Some(n) = n.checked_sub(4) { n } else { n }

tests/ui/dbg_macro/dbg_macro.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
#![allow(
2+
clippy::no_effect,
3+
clippy::uninlined_format_args,
4+
clippy::unit_arg,
5+
clippy::unnecessary_operation
6+
)]
17
#![warn(clippy::dbg_macro)]
2-
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]
38

49
fn foo(n: u32) -> u32 {
510
if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }

tests/ui/dbg_macro/dbg_macro.stderr

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: the `dbg!` macro is intended as a debugging tool
2-
--> tests/ui/dbg_macro/dbg_macro.rs:5:22
2+
--> tests/ui/dbg_macro/dbg_macro.rs:10:22
33
|
44
LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
55
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL + if let Some(n) = n.checked_sub(4) { n } else { n }
1313
|
1414

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

2727
error: the `dbg!` macro is intended as a debugging tool
28-
--> tests/ui/dbg_macro/dbg_macro.rs:14:9
28+
--> tests/ui/dbg_macro/dbg_macro.rs:19:9
2929
|
3030
LL | dbg!(1)
3131
| ^^^^^^^
@@ -37,7 +37,7 @@ LL + 1
3737
|
3838

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

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

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

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

8787
error: the `dbg!` macro is intended as a debugging tool
88-
--> tests/ui/dbg_macro/dbg_macro.rs:51:5
88+
--> tests/ui/dbg_macro/dbg_macro.rs:56:5
8989
|
9090
LL | dbg!();
9191
| ^^^^^^
@@ -96,7 +96,7 @@ LL - dbg!();
9696
|
9797

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

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

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

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

146146
error: the `dbg!` macro is intended as a debugging tool
147-
--> tests/ui/dbg_macro/dbg_macro.rs:46:13
147+
--> tests/ui/dbg_macro/dbg_macro.rs:51:13
148148
|
149149
LL | dbg!();
150150
| ^^^^^^
@@ -159,7 +159,7 @@ LL - dbg!();
159159
|
160160

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

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

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

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

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

221221
error: the `dbg!` macro is intended as a debugging tool
222-
--> tests/ui/dbg_macro/dbg_macro.rs:117:22
222+
--> tests/ui/dbg_macro/dbg_macro.rs:122:22
223223
|
224224
LL | print!("{}", dbg!(s));
225225
| ^^^^^^^

tests/ui/large_futures.fixed

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
#![allow(
2+
clippy::future_not_send,
3+
clippy::manual_async_fn,
4+
clippy::never_loop,
5+
clippy::uninlined_format_args
6+
)]
17
#![warn(clippy::large_futures)]
2-
#![allow(clippy::never_loop)]
3-
#![allow(clippy::future_not_send)]
4-
#![allow(clippy::manual_async_fn)]
58

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

tests/ui/large_futures.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
#![allow(
2+
clippy::future_not_send,
3+
clippy::manual_async_fn,
4+
clippy::never_loop,
5+
clippy::uninlined_format_args
6+
)]
17
#![warn(clippy::large_futures)]
2-
#![allow(clippy::never_loop)]
3-
#![allow(clippy::future_not_send)]
4-
#![allow(clippy::manual_async_fn)]
58

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

tests/ui/large_futures.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: large future with a size of 16385 bytes
2-
--> tests/ui/large_futures.rs:10:9
2+
--> tests/ui/large_futures.rs:13:9
33
|
44
LL | big_fut([0u8; 1024 * 16]).await;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(big_fut([0u8; 1024 * 16]))`
@@ -8,37 +8,37 @@ LL | big_fut([0u8; 1024 * 16]).await;
88
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`
99

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

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

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

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

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

4040
error: large future with a size of 65540 bytes
41-
--> tests/ui/large_futures.rs:48:5
41+
--> tests/ui/large_futures.rs:51:5
4242
|
4343
LL | / async {
4444
LL | |
@@ -61,7 +61,7 @@ LL + })
6161
|
6262

6363
error: large future with a size of 65540 bytes
64-
--> tests/ui/large_futures.rs:61:13
64+
--> tests/ui/large_futures.rs:64:13
6565
|
6666
LL | / async {
6767
LL | |

tests/ui/manual_inspect.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]
12
#![warn(clippy::manual_inspect)]
2-
#![allow(clippy::no_effect, clippy::op_ref)]
33

44
fn main() {
55
let _ = Some(0).inspect(|&x| {

tests/ui/manual_inspect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]
12
#![warn(clippy::manual_inspect)]
2-
#![allow(clippy::no_effect, clippy::op_ref)]
33

44
fn main() {
55
let _ = Some(0).map(|x| {

tests/ui/manual_strip_fixable.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::manual_strip)]
2+
#![allow(clippy::uninlined_format_args)]
23

34
fn main() {
45
let s = "abc";

tests/ui/manual_strip_fixable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::manual_strip)]
2+
#![allow(clippy::uninlined_format_args)]
23

34
fn main() {
45
let s = "abc";

tests/ui/manual_strip_fixable.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: stripping a prefix manually
2-
--> tests/ui/manual_strip_fixable.rs:7:24
2+
--> tests/ui/manual_strip_fixable.rs:8:24
33
|
44
LL | let stripped = &s["ab".len()..];
55
| ^^^^^^^^^^^^^^^^
66
|
77
note: the prefix was tested here
8-
--> tests/ui/manual_strip_fixable.rs:6:5
8+
--> tests/ui/manual_strip_fixable.rs:7:5
99
|
1010
LL | if s.starts_with("ab") {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -19,13 +19,13 @@ LL ~ println!("{stripped}{}", stripped);
1919
|
2020

2121
error: stripping a suffix manually
22-
--> tests/ui/manual_strip_fixable.rs:13:24
22+
--> tests/ui/manual_strip_fixable.rs:14:24
2323
|
2424
LL | let stripped = &s[..s.len() - "bc".len()];
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2626
|
2727
note: the suffix was tested here
28-
--> tests/ui/manual_strip_fixable.rs:12:5
28+
--> tests/ui/manual_strip_fixable.rs:13:5
2929
|
3030
LL | if s.ends_with("bc") {
3131
| ^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)