gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1114HTML 1040Markdown 12TOML 94698 Definiciones

code cleanup

f2bcf096492490bf1a8d89f4e144d775daadd1d0 · por Emil Sjölander · (hace 7 años) · padre e6356a335 · ver el árbol en este commit

Delta semántico · 1

src/algo.rs

1 archivos · +5 −13

diff --git a/src/algo.rs b/src/algo.rs
index 301fdf6d3..96df6eff8 100644
--- a/src/algo.rs
+++ b/src/algo.rs
@@ -682,19 +682,11 @@ fn compute_internal(
             //    - Negative
             //        Freeze all the items with max violations.
 
-            if !total_violation.is_normal() {
-                for child in &mut unfrozen {
-                    child.frozen = true;
-                }
-            } else if total_violation > 0.0 {
-                for child in &mut unfrozen {
-                    child.frozen = child.violation > 0.0;
-                }
-            } else if total_violation < 0.0 {
-                for child in &mut unfrozen {
-                    child.frozen = child.violation < 0.0;
-                }
-            }
+            unfrozen.iter_mut().for_each(|child| match total_violation {
+                v if v > 0.0 => child.frozen = child.violation > 0.0,
+                v if v < 0.0 => child.frozen = child.violation < 0.0,
+                _ => child.frozen = true,
+            })
 
             // f. Return to the start of this loop.
         }