Skip to content

Commit 3b0d711

Browse files
committed
fix an if statement that can be collapsed
1 parent f2918cd commit 3b0d711

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

crates/libm-macros/src/lib.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -266,27 +266,27 @@ fn validate(input: &mut StructuredInput) -> syn::Result<Vec<&'static MathOpInfo>
266266
}
267267
}
268268

269-
if let Some(map) = &input.fn_extra {
270-
if !map.keys().any(|key| key == "_") {
271-
// No default provided; make sure every expected function is covered
272-
let mut fns_not_covered = Vec::new();
273-
for func in &fn_list {
274-
if !map.keys().any(|key| key == func.name) {
275-
// `name` was not mentioned in the `match` statement
276-
fns_not_covered.push(func);
277-
}
269+
if let Some(map) = &input.fn_extra
270+
&& !map.keys().any(|key| key == "_")
271+
{
272+
// No default provided; make sure every expected function is covered
273+
let mut fns_not_covered = Vec::new();
274+
for func in &fn_list {
275+
if !map.keys().any(|key| key == func.name) {
276+
// `name` was not mentioned in the `match` statement
277+
fns_not_covered.push(func);
278278
}
279+
}
279280

280-
if !fns_not_covered.is_empty() {
281-
let e = syn::Error::new(
282-
input.fn_extra_span.unwrap(),
283-
format!(
284-
"`fn_extra`: no default `_` pattern specified and the following \
285-
patterns are not covered: {fns_not_covered:#?}"
286-
),
287-
);
288-
return Err(e);
289-
}
281+
if !fns_not_covered.is_empty() {
282+
let e = syn::Error::new(
283+
input.fn_extra_span.unwrap(),
284+
format!(
285+
"`fn_extra`: no default `_` pattern specified and the following \
286+
patterns are not covered: {fns_not_covered:#?}"
287+
),
288+
);
289+
return Err(e);
290290
}
291291
};
292292

0 commit comments

Comments
 (0)