Skip to content

Commit f871e38

Browse files
committed
Remove unwraps in generated tests.
Accompanies: 4a9ac5e
1 parent 89b8ce1 commit f871e38

File tree

913 files changed

+29366
-35823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

913 files changed

+29366
-35823
lines changed

scripts/gentest/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn generate_test(name: impl AsRef<str>, description: &Value) -> TokenStream {
157157
let mut taffy = taffy::Taffy::new();
158158
#set_rounding_mode
159159
#node_description
160-
taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
160+
taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT);
161161

162162
println!("\nComputed tree:");
163163
taffy::util::print_tree(&taffy, node);
@@ -191,7 +191,7 @@ fn generate_assertions(ident: &str, node: &Value, use_rounding: bool) -> TokenSt
191191

192192
if use_rounding {
193193
quote!(
194-
let Layout { size, location, .. } = taffy.layout(#ident).unwrap();
194+
let Layout { size, location, .. } = taffy.layout(#ident);
195195
assert_eq!(size.width, #width, "width of node {:?}. Expected {}. Actual {}", #ident, #width, size.width);
196196
assert_eq!(size.height, #height, "height of node {:?}. Expected {}. Actual {}", #ident, #height, size.height);
197197
assert_eq!(location.x, #x, "x of node {:?}. Expected {}. Actual {}", #ident, #x, location.x);
@@ -201,7 +201,7 @@ fn generate_assertions(ident: &str, node: &Value, use_rounding: bool) -> TokenSt
201201
)
202202
} else {
203203
quote!(
204-
let Layout { size, location, .. } = taffy.layout(#ident).unwrap();
204+
let Layout { size, location, .. } = taffy.layout(#ident);
205205
assert!(size.width - #width < 0.1, "width of node {:?}. Expected {}. Actual {}", #ident, #width, size.width);
206206
assert!(size.height - #height < 0.1, "height of node {:?}. Expected {}. Actual {}", #ident, #height, size.height);
207207
assert!(location.x - #x < 0.1, "x of node {:?}. Expected {}. Actual {}", #ident, #x, location.x);
@@ -606,12 +606,12 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream {
606606
if has_children {
607607
quote!(
608608
#children_body
609-
let #ident = taffy.new_with_children(#style,#children).unwrap();
609+
let #ident = taffy.new_with_children(#style,#children);
610610
)
611611
} else if measure_func.is_some() {
612-
quote!(let #ident = taffy.new_leaf_with_measure(#style,#measure_func,).unwrap();)
612+
quote!(let #ident = taffy.new_leaf_with_measure(#style,#measure_func,);)
613613
} else {
614-
quote!(let #ident = taffy.new_leaf(#style).unwrap();)
614+
quote!(let #ident = taffy.new_leaf(#style);)
615615
}
616616
}
617617

tests/generated/absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset.rs

Lines changed: 23 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/generated/absolute_aspect_ratio_fill_height.rs

Lines changed: 24 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/generated/absolute_aspect_ratio_fill_height_from_inset.rs

Lines changed: 23 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/generated/absolute_aspect_ratio_fill_max_height.rs

Lines changed: 32 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/generated/absolute_aspect_ratio_fill_max_width.rs

Lines changed: 32 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)