MCPcopy Create free account
hub / github.com/csskit/csskit / fmt_compacted

Method fmt_compacted

crates/css_lexer/src/source_cursor.rs:216–233  ·  view source on GitHub ↗
(&self, f: &mut Formatter<'_>)

Source from the content-addressed store, hash-verified

214 }
215
216 fn fmt_compacted(&self, f: &mut Formatter<'_>) -> Result {
217 let token = self.token();
218 match token.kind() {
219 Kind::Whitespace => f.write_str(" "),
220 Kind::Ident | Kind::Function | Kind::AtKeyword | Kind::Hash
221 if self.should_compact && token.contains_escape_chars() =>
222 {
223 self.fmt_compacted_ident(f)
224 }
225 Kind::Number => self.fmt_compacted_number(f),
226 Kind::Dimension => {
227 self.fmt_compacted_number(f)?;
228 self.fmt_compacted_ident(f)
229 }
230 Kind::Url => self.fmt_compacted_url(f),
231 _ => f.write_str(self.source),
232 }
233 }
234
235 fn fmt_compacted_number(&self, f: &mut Formatter<'_>) -> Result {
236 let value = self.token().value();

Callers 1

fmtMethod · 0.80

Calls 7

write_strMethod · 0.80
contains_escape_charsMethod · 0.80
fmt_compacted_identMethod · 0.80
fmt_compacted_numberMethod · 0.80
fmt_compacted_urlMethod · 0.80
tokenMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected