Fix: Clippy lint 'uninlined_format_args'

This commit is contained in:
13r0ck 2023-01-27 13:25:04 -07:00
parent e6092e81a4
commit 42b1bfe66d
25 changed files with 47 additions and 54 deletions

View file

@ -58,10 +58,10 @@ impl<T> fmt::Debug for Action<T> {
match self {
Self::Future(_) => write!(f, "Action::Future"),
Self::Clipboard(action) => {
write!(f, "Action::Clipboard({:?})", action)
write!(f, "Action::Clipboard({action:?})")
}
Self::Window(action) => write!(f, "Action::Window({:?})", action),
Self::System(action) => write!(f, "Action::System({:?})", action),
Self::Window(action) => write!(f, "Action::Window({action:?})"),
Self::System(action) => write!(f, "Action::System({action:?})"),
Self::Widget(_action) => write!(f, "Action::Widget"),
}
}

View file

@ -133,7 +133,7 @@ impl Debug {
}
pub fn log_message<Message: std::fmt::Debug>(&mut self, message: &Message) {
self.last_messages.push_back(format!("{:?}", message));
self.last_messages.push_back(format!("{message:?}"));
if self.last_messages.len() > 10 {
let _ = self.last_messages.pop_front();
@ -150,7 +150,7 @@ impl Debug {
let mut lines = Vec::new();
fn key_value<T: std::fmt::Debug>(key: &str, value: T) -> String {
format!("{} {:?}", key, value)
format!("{key} {value:?}")
}
lines.push(format!(
@ -176,9 +176,9 @@ impl Debug {
lines.push(String::from("Last messages:"));
lines.extend(self.last_messages.iter().map(|msg| {
if msg.len() <= 100 {
format!(" {}", msg)
format!(" {msg}")
} else {
format!(" {:.100}...", msg)
format!(" {msg:.100}...")
}
}));

View file

@ -107,10 +107,10 @@ pub enum Data {
impl std::fmt::Debug for Data {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Data::Path(path) => write!(f, "Path({:?})", path),
Data::Path(path) => write!(f, "Path({path:?})"),
Data::Bytes(_) => write!(f, "Bytes(...)"),
Data::Rgba { width, height, .. } => {
write!(f, "Pixels({} * {})", width, height)
write!(f, "Pixels({width} * {height})")
}
}
}

View file

@ -71,7 +71,7 @@ pub enum Data {
impl std::fmt::Debug for Data {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Data::Path(path) => write!(f, "Path({:?})", path),
Data::Path(path) => write!(f, "Path({path:?})"),
Data::Bytes(_) => write!(f, "Bytes(...)"),
}
}

View file

@ -62,7 +62,7 @@ where
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::None => write!(f, "Outcome::None"),
Self::Some(output) => write!(f, "Outcome::Some({:?})", output),
Self::Some(output) => write!(f, "Outcome::Some({output:?})"),
Self::Chain(_) => write!(f, "Outcome::Chain(...)"),
}
}

View file

@ -106,15 +106,14 @@ impl<T> fmt::Debug for Action<T> {
Self::Drag => write!(f, "Action::Drag"),
Self::Resize { width, height } => write!(
f,
"Action::Resize {{ widget: {}, height: {} }}",
width, height
"Action::Resize {{ widget: {width}, height: {height} }}"
),
Self::Maximize(value) => write!(f, "Action::Maximize({})", value),
Self::Minimize(value) => write!(f, "Action::Minimize({}", value),
Self::Maximize(value) => write!(f, "Action::Maximize({value})"),
Self::Minimize(value) => write!(f, "Action::Minimize({value}"),
Self::Move { x, y } => {
write!(f, "Action::Move {{ x: {}, y: {} }}", x, y)
write!(f, "Action::Move {{ x: {x}, y: {y} }}")
}
Self::SetMode(mode) => write!(f, "Action::SetMode({:?})", mode),
Self::SetMode(mode) => write!(f, "Action::SetMode({mode:?})"),
Self::FetchMode(_) => write!(f, "Action::FetchMode"),
Self::ToggleMaximize => write!(f, "Action::ToggleMaximize"),
Self::ToggleDecorations => write!(f, "Action::ToggleDecorations"),