Skip to content

Commit af5637a

Browse files
committed
split
1 parent e1b05c9 commit af5637a

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

libs/extractor/src/extractor/extract_style_from_expression.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -418,25 +418,27 @@ pub fn extract_style_from_expression<'a>(
418418
},
419419
..ExtractResult::default()
420420
},
421+
// Each variant is kept on its own line so per-line coverage
422+
// tools (tarpaulin on CI) can attribute the hit to the exact
423+
// pattern being exercised. The body is flattened to a single
424+
// `Option::map().unwrap_or_default()` chain to avoid an extra
425+
// if/else branch region — `name == None` happens only under
426+
// `_xxx={...}` pseudo-selector recursion, where no dynamic_style
427+
// can be emitted because the selector has no CSS property slot.
421428
Expression::BinaryExpression(_)
422429
| Expression::StaticMemberExpression(_)
423-
| Expression::CallExpression(_) => {
424-
if let Some(name) = name {
425-
ExtractResult {
426-
styles: vec![dynamic_style(
427-
ast_builder,
428-
name,
429-
expression,
430-
level,
431-
selector,
432-
)],
433-
..ExtractResult::default()
434-
}
435-
} else {
436-
// See comment on UnaryExpression arm above.
437-
ExtractResult::default()
438-
}
439-
}
430+
| Expression::CallExpression(_) => name
431+
.map(|name| ExtractResult {
432+
styles: vec![dynamic_style(
433+
ast_builder,
434+
name,
435+
expression,
436+
level,
437+
selector,
438+
)],
439+
..ExtractResult::default()
440+
})
441+
.unwrap_or_default(),
440442
Expression::TSAsExpression(exp) => extract_style_from_expression(
441443
ast_builder,
442444
name,

0 commit comments

Comments
 (0)