Skip to content

Conversation

@dtolnay
Copy link
Owner

@dtolnay dtolnay commented Sep 19, 2025

Closes #408.

Example lint:

warning: `format!` in `bail!` args
 --> src/main.rs:5:5
  |
5 |     bail!("{}", format!("something failed at {}", Location::caller()));
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: combine the `format!(..)` arguments with the outer `bail!(..)` call
  = help: or consider changing `format!` to `format_args!`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_in_format_args
  = note: `#[warn(clippy::format_in_format_args)]` on by default

@dtolnay dtolnay merged commit f271988 into master Sep 19, 2025
28 checks passed
@dtolnay dtolnay deleted the clippyfmt branch September 19, 2025 06:37
mischnic pushed a commit to vercel/next.js that referenced this pull request Nov 6, 2025
- `anyhow` now causes `cargo clippy` to warn about `.to_string()` in `bail!(...)` calls. I also inlined most of these format string variables while I was at it. dtolnay/anyhow#426
- The `backtrace` feature isn't needed (and is a no-op) since Rust 1.65. https://github.com/dtolnay/anyhow/blob/master/Cargo.toml#L19-L22
huozhi pushed a commit to vercel/next.js that referenced this pull request Nov 12, 2025
- `anyhow` now causes `cargo clippy` to warn about `.to_string()` in `bail!(...)` calls. I also inlined most of these format string variables while I was at it. dtolnay/anyhow#426
- The `backtrace` feature isn't needed (and is a no-op) since Rust 1.65. https://github.com/dtolnay/anyhow/blob/master/Cargo.toml#L19-L22
huozhi pushed a commit to vercel/next.js that referenced this pull request Nov 12, 2025
- `anyhow` now causes `cargo clippy` to warn about `.to_string()` in `bail!(...)` calls. I also inlined most of these format string variables while I was at it. dtolnay/anyhow#426
- The `backtrace` feature isn't needed (and is a no-op) since Rust 1.65. https://github.com/dtolnay/anyhow/blob/master/Cargo.toml#L19-L22
Moroshima pushed a commit to Moroshima/next.js that referenced this pull request Nov 20, 2025
…#85844)

- `anyhow` now causes `cargo clippy` to warn about `.to_string()` in `bail!(...)` calls. I also inlined most of these format string variables while I was at it. dtolnay/anyhow#426
- The `backtrace` feature isn't needed (and is a no-op) since Rust 1.65. https://github.com/dtolnay/anyhow/blob/master/Cargo.toml#L19-L22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add #[clippy::format_args] on some macros

2 participants