Skip to content

Commit

Permalink
Move uninlined_format_args to style
Browse files Browse the repository at this point in the history
This lint was downgraded to `pedantic` in part because rust-analyzer was not fully supporting it at the time per rust-lang#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.
  • Loading branch information
nyurik committed Feb 15, 2025
1 parent a9f680c commit 3cce21d
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![deny(clippy::index_refutable_slice)]

#![allow(clippy::uninlined_format_args)]
fn below_limit() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some([_, _, _, _, _, _, _, slice_7, ..]) = slice {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![deny(clippy::index_refutable_slice)]

#![allow(clippy::uninlined_format_args)]
fn below_limit() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/author/macro_in_closure.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ check-pass
#![allow(clippy::uninlined_format_args)]

fn main() {
#[clippy::author]
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
2 changes: 1 addition & 1 deletion tests/ui/dbg_macro/dbg_macro.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![warn(clippy::dbg_macro)]
#![allow(clippy::unnecessary_operation, clippy::no_effect, clippy::unit_arg)]

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

#![allow(clippy::uninlined_format_args)]
fn foo(n: u32) -> u32 {
if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
//~^ dbg_macro
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/large_futures.fixed
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![warn(clippy::large_futures)]
#![allow(clippy::never_loop)]
#![allow(clippy::future_not_send)]
#![allow(clippy::manual_async_fn)]
#![allow(clippy::manual_async_fn, clippy::uninlined_format_args)]

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

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

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

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 @@
#![warn(clippy::manual_inspect)]
#![allow(clippy::no_effect, clippy::op_ref)]
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]

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 @@
#![warn(clippy::manual_inspect)]
#![allow(clippy::no_effect, clippy::op_ref)]
#![allow(clippy::no_effect, clippy::op_ref, clippy::uninlined_format_args)]

fn main() {
let _ = Some(0).map(|x| {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/needless_pass_by_ref_mut.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#![allow(
clippy::if_same_then_else,
clippy::no_effect,
clippy::ptr_arg,
clippy::redundant_closure_call,
clippy::ptr_arg
clippy::uninlined_format_args
)]
#![warn(clippy::needless_pass_by_ref_mut)]
//@no-rustfix
use std::ptr::NonNull;

fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
//~^ needless_pass_by_ref_mut

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/to_string_in_format_args_incremental.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@compile-flags: -C incremental=target/debug/test/incr

#![allow(clippy::uninlined_format_args)]
// see https://github.com/rust-lang/rust-clippy/issues/10969

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/to_string_in_format_args_incremental.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@compile-flags: -C incremental=target/debug/test/incr

#![allow(clippy::uninlined_format_args)]
// see https://github.com/rust-lang/rust-clippy/issues/10969

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unnecessary_iter_cloned.fixed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused_assignments)]
#![allow(unused_assignments, clippy::uninlined_format_args)]
#![warn(clippy::unnecessary_to_owned)]

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unnecessary_iter_cloned.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused_assignments)]
#![allow(unused_assignments, clippy::uninlined_format_args)]
#![warn(clippy::unnecessary_to_owned)]

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unnecessary_operation.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
clippy::unnecessary_struct_initialization
)]
#![warn(clippy::unnecessary_operation)]

#![allow(clippy::uninlined_format_args)]
use std::fmt::Display;
use std::ops::Shl;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unnecessary_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
clippy::unnecessary_struct_initialization
)]
#![warn(clippy::unnecessary_operation)]

#![allow(clippy::uninlined_format_args)]
use std::fmt::Display;
use std::ops::Shl;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unnecessary_to_owned.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
clippy::needless_lifetimes
)]
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]

#![allow(clippy::uninlined_format_args)]
use std::borrow::Cow;
use std::ffi::{CStr, CString, OsStr, OsString};
use std::ops::Deref;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unnecessary_to_owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
clippy::needless_lifetimes
)]
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]

#![allow(clippy::uninlined_format_args)]
use std::borrow::Cow;
use std::ffi::{CStr, CString, OsStr, OsString};
use std::ops::Deref;
Expand Down

0 comments on commit 3cce21d

Please sign in to comment.