Skip to content

Fix incorrect uninlined_format_args edge case #9588

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

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 11 additions & 1 deletion tests/ui/uninlined_format_args.fixed
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// aux-build:proc_macro_with_span.rs
// run-rustfix

#![feature(custom_inner_attributes)]
#![warn(clippy::uninlined_format_args)]
#![allow(named_arguments_used_positionally, unused_imports, unused_macros, unused_variables)]
#![allow(clippy::eq_op, clippy::format_in_format_args, clippy::print_literal)]
#![allow(
clippy::double_parens,
clippy::eq_op,
clippy::format_in_format_args,
clippy::print_literal
)]

extern crate proc_macro_with_span;
use proc_macro_with_span::with_span;
Expand Down Expand Up @@ -123,6 +129,10 @@ fn tester(fn_arg: i32) {
println!("{}", format!("{local_i32}"));
my_println!("{}", local_i32);
my_println_args!("{}", local_i32);
println!("{local_i32}");
#[rustfmt::skip]
println!("{local_i32}");
println!("{local_i32:width$.prec$}");

// these should NOT be modified by the lint
println!(concat!("nope ", "{}"), local_i32);
Expand Down
12 changes: 11 additions & 1 deletion tests/ui/uninlined_format_args.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// aux-build:proc_macro_with_span.rs
// run-rustfix

#![feature(custom_inner_attributes)]
#![warn(clippy::uninlined_format_args)]
#![allow(named_arguments_used_positionally, unused_imports, unused_macros, unused_variables)]
#![allow(clippy::eq_op, clippy::format_in_format_args, clippy::print_literal)]
#![allow(
clippy::double_parens,
clippy::eq_op,
clippy::format_in_format_args,
clippy::print_literal
)]

extern crate proc_macro_with_span;
use proc_macro_with_span::with_span;
Expand Down Expand Up @@ -126,6 +132,10 @@ fn tester(fn_arg: i32) {
println!("{}", format!("{}", local_i32));
my_println!("{}", local_i32);
my_println_args!("{}", local_i32);
println!("{}", (local_i32));
#[rustfmt::skip]
println!("{}", ((local_i32)));
println!("{0:1$.2$}", (local_i32), (width), (prec));

// these should NOT be modified by the lint
println!(concat!("nope ", "{}"), local_i32);
Expand Down
Loading