Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ fn main() {
};

let style = simplecss::StyleSheet::parse(&text);
println!("{:#?}", style);
println!("{style:#?}");
}
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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})"),
}
}
}
Expand Down Expand Up @@ -367,28 +367,28 @@ 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 {
match sel {
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}")?,
}
}
}
Expand Down
Loading