From e0c907017d319c76aa20e2b591f314fe29f65b9a Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 16 May 2025 11:04:04 +0200 Subject: [PATCH] Fix `clippy::uninlined_format_args` lints --- examples/parse.rs | 2 +- src/lib.rs | 6 +++--- src/selector.rs | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/parse.rs b/examples/parse.rs index 0ad9752..c355d17 100644 --- a/examples/parse.rs +++ b/examples/parse.rs @@ -28,5 +28,5 @@ fn main() { }; let style = simplecss::StyleSheet::parse(&text); - println!("{:#?}", style); + println!("{style:#?}"); } diff --git a/src/lib.rs b/src/lib.rs index 99e0067..a06474e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,13 +117,13 @@ impl fmt::Display for Error { write!(f, "unexpected end of stream") } Error::InvalidIdent(pos) => { - write!(f, "invalid ident at {}", pos) + write!(f, "invalid ident at {pos}") } Error::InvalidComment(pos) => { - write!(f, "invalid comment at {}", pos) + write!(f, "invalid comment at {pos}") } Error::InvalidValue(pos) => { - write!(f, "invalid value at {}", pos) + write!(f, "invalid value at {pos}") } Error::InvalidByte { expected, diff --git a/src/selector.rs b/src/selector.rs index 66332c4..e902933 100644 --- a/src/selector.rs +++ b/src/selector.rs @@ -65,7 +65,7 @@ impl fmt::Display for PseudoClass<'_> { PseudoClass::Hover => write!(f, "hover"), PseudoClass::Active => write!(f, "active"), PseudoClass::Focus => write!(f, "focus"), - PseudoClass::Lang(lang) => write!(f, "lang({})", lang), + PseudoClass::Lang(lang) => write!(f, "lang({lang})"), } } } @@ -367,7 +367,7 @@ impl fmt::Display for Selector<'_> { match component.selector.kind { SimpleSelectorType::Universal => write!(f, "*")?, - SimpleSelectorType::Type(ident) => write!(f, "{}", ident)?, + SimpleSelectorType::Type(ident) => write!(f, "{ident}")?, }; for sel in &component.selector.subselectors { @@ -375,20 +375,20 @@ impl fmt::Display for Selector<'_> { SubSelector::Attribute(name, operator) => { match operator { AttributeOperator::Exists => { - write!(f, "[{}]", name)?; + write!(f, "[{name}]")?; } AttributeOperator::Matches(value) => { - write!(f, "[{}='{}']", name, value)?; + write!(f, "[{name}='{value}']")?; } AttributeOperator::Contains(value) => { - write!(f, "[{}~='{}']", name, value)?; + write!(f, "[{name}~='{value}']")?; } AttributeOperator::StartsWith(value) => { - write!(f, "[{}|='{}']", name, value)?; + write!(f, "[{name}|='{value}']")?; } }; } - SubSelector::PseudoClass(class) => write!(f, ":{}", class)?, + SubSelector::PseudoClass(class) => write!(f, ":{class}")?, } } }