From 81b8e291721c324c8343621a2d9d1d7b02418434 Mon Sep 17 00:00:00 2001 From: Cornel Punga Date: Wed, 24 Jun 2015 09:21:35 +0300 Subject: [PATCH] Update methods perimeter expression In my opinion this version is more readable, also theoretically faster. --- examples/fn/methods/methods.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/fn/methods/methods.rs b/examples/fn/methods/methods.rs index 599ee4c469..26c803a663 100644 --- a/examples/fn/methods/methods.rs +++ b/examples/fn/methods/methods.rs @@ -41,7 +41,7 @@ impl Rectangle { let Point { x: x1, y: y1 } = self.p1; let Point { x: x2, y: y2 } = self.p2; - 2.0 * (x1 - x2).abs() + 2.0 * (y1 - y2).abs() + 2.0 * ((x1 - x2).abs() + (y1 - y2).abs()) } // This method requires the caller object to be mutable