From 080cac54d4f426634856bc2a4e23d54e6bd5f912 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 2 Sep 2023 13:13:48 -0700 Subject: [PATCH] Ignore uninlined_format_args pedantic clippy lint warning: variables can be used directly in the `format!` string --> tests/test_generics.rs:93:5 | 93 | assert_eq!(format!("{}", instance), "display only DebugOnly"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 93 - assert_eq!(format!("{}", instance), "display only DebugOnly"); 93 + assert_eq!(format!("{instance}"), "display only DebugOnly"); | warning: variables can be used directly in the `format!` string --> tests/test_generics.rs:96:5 | 96 | assert_eq!(format!("{}", instance), "display only"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 96 - assert_eq!(format!("{}", instance), "display only"); 96 + assert_eq!(format!("{instance}"), "display only"); | warning: variables can be used directly in the `format!` string --> tests/test_generics.rs:99:5 | 99 | assert_eq!(format!("{}", instance), "DebugOnly"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 99 - assert_eq!(format!("{}", instance), "DebugOnly"); 99 + assert_eq!(format!("{instance}"), "DebugOnly"); | warning: `thiserror` (test "test_generics") generated 3 warnings (run `cargo clippy --fix --test "test_generics"` to apply 3 suggestions) warning: variables can be used directly in the `format!` string --> tests/test_display.rs:129:20 | 129 | Some(n) => format!("error occurred with {}", n), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 129 - Some(n) => format!("error occurred with {}", n), 129 + Some(n) => format!("error occurred with {n}"), | warning: variables can be used directly in the `format!` string --> tests/test_display.rs:153:32 | 153 | Some(n) => write!(formatter, "error occurred with {}", n), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 153 - Some(n) => write!(formatter, "error occurred with {}", n), 153 + Some(n) => write!(formatter, "error occurred with {n}"), | --- tests/test_display.rs | 2 ++ tests/test_generics.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_display.rs b/tests/test_display.rs index 99ce2fd..6f60388 100644 --- a/tests/test_display.rs +++ b/tests/test_display.rs @@ -1,3 +1,5 @@ +#![allow(clippy::uninlined_format_args)] + use std::fmt::{self, Display}; use thiserror::Error; diff --git a/tests/test_generics.rs b/tests/test_generics.rs index 4ab9f37..c94d95e 100644 --- a/tests/test_generics.rs +++ b/tests/test_generics.rs @@ -1,4 +1,4 @@ -#![allow(clippy::needless_late_init)] +#![allow(clippy::needless_late_init, clippy::uninlined_format_args)] use std::fmt::{self, Debug, Display}; use thiserror::Error;