Skip to content

Commit 179df53

Browse files
fix(join!): handling of nested Results
1 parent 7c983c3 commit 179df53

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

benzina-derive/src/join/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl Transformation {
195195
#(#entries),*
196196
}
197197
};
198-
let map_closure = if is_result {
198+
let map_closure = if self.is_nested_result() {
199199
quote! {
200200
|item| ::benzina::__private::std::result::Result::Ok::<
201201
#output_type,
@@ -269,13 +269,17 @@ impl Transformation {
269269

270270
fn is_result(&self) -> bool {
271271
match self.quantity {
272-
Quantity::AtLeastZero | Quantity::AtLeastOne => true,
273-
_ => self.entries.iter().any(|(_, entry)| match entry {
274-
NestedOrNot::Nested(nested) => nested.is_result(),
275-
NestedOrNot::Not(_) => false,
276-
}),
272+
Quantity::One | Quantity::AssumeOne => true,
273+
_ => self.is_nested_result(),
277274
}
278275
}
276+
277+
fn is_nested_result(&self) -> bool {
278+
self.entries.iter().any(|(_, entry)| match entry {
279+
NestedOrNot::Nested(nested) => nested.is_result(),
280+
NestedOrNot::Not(_) => false,
281+
})
282+
}
279283
}
280284

281285
impl NoTransformation {

0 commit comments

Comments
 (0)