Skip to content

Commit 6095a2d

Browse files
committed
Fix coverage
1 parent 180ccf0 commit 6095a2d

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

libs/extractor/src/extractor/extract_global_style_from_expression.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,27 @@ pub fn extract_global_style_from_expression<'a>(
5050
if name == "imports" {
5151
if let Expression::ArrayExpression(arr) = &o.value {
5252
for p in arr.elements.iter() {
53-
styles.push(ExtractStyleProp::Static(ExtractStyleValue::Import(
54-
ExtractImport {
55-
url: if let ArrayExpressionElement::StringLiteral(s) = p {
56-
s.value.trim().to_string()
57-
} else if let ArrayExpressionElement::TemplateLiteral(t) = p {
58-
t.quasis
59-
.iter()
60-
.map(|q| q.value.raw.as_str())
61-
.collect::<String>()
62-
.trim()
63-
.to_string()
64-
} else {
65-
continue;
53+
if let Some(url) = if let ArrayExpressionElement::StringLiteral(s) = p {
54+
Some(s.value.trim().to_string())
55+
} else if let ArrayExpressionElement::TemplateLiteral(t) = p {
56+
Some(
57+
t.quasis
58+
.iter()
59+
.map(|q| q.value.raw.as_str())
60+
.collect::<String>()
61+
.trim()
62+
.to_string(),
63+
)
64+
} else {
65+
None
66+
} {
67+
styles.push(ExtractStyleProp::Static(ExtractStyleValue::Import(
68+
ExtractImport {
69+
url,
70+
file: file.to_string(),
6671
},
67-
file: file.to_string(),
68-
},
69-
)));
72+
)));
73+
}
7074
}
7175
}
7276
} else if name == "fontFaces" {

0 commit comments

Comments
 (0)