Re-enable clippy useless-format (#14095)

This commit is contained in:
Simon Brugman 2024-11-04 18:25:25 +01:00 committed by GitHub
parent fb94b71e63
commit b7e32b0a18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 5 deletions

View file

@ -85,7 +85,8 @@ pub struct ReturnInGenerator;
impl Violation for ReturnInGenerator { impl Violation for ReturnInGenerator {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!("Using `yield` and `return {{value}}` in a generator function can lead to confusing behavior") "Using `yield` and `return {value}` in a generator function can lead to confusing behavior"
.to_string()
} }
} }

View file

@ -47,7 +47,7 @@ impl Violation for UnnecessaryLiteralUnion {
} }
fn fix_title(&self) -> Option<String> { fn fix_title(&self) -> Option<String> {
Some(format!("Replace with a single `Literal`",)) Some("Replace with a single `Literal`".to_string())
} }
} }

View file

@ -37,7 +37,7 @@ impl Violation for UnnecessaryTypeUnion {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
let union_str = if self.is_pep604_union { let union_str = if self.is_pep604_union {
format!("{}", self.members.join(" | ")) self.members.join(" | ")
} else { } else {
format!("Union[{}]", self.members.join(", ")) format!("Union[{}]", self.members.join(", "))
}; };

View file

@ -1,4 +1,3 @@
#![allow(clippy::useless_format)]
pub mod airflow; pub mod airflow;
pub mod eradicate; pub mod eradicate;
pub mod fastapi; pub mod fastapi;

View file

@ -30,6 +30,8 @@ pub struct IOError {
/// E902 /// E902
impl Violation for IOError { impl Violation for IOError {
// The format message is used by the `derive_message_formats` macro.
#![allow(clippy::useless_format)]
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
let IOError { message } = self; let IOError { message } = self;

View file

@ -53,7 +53,7 @@ impl Violation for EscapeSequenceInDocstring {
} }
fn fix_title(&self) -> Option<String> { fn fix_title(&self) -> Option<String> {
Some(format!(r#"Add `r` prefix"#)) Some(r#"Add `r` prefix"#.to_string())
} }
} }