From fc818ff33b8b83ec1c669660acab37fc6576eee4 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 1 Oct 2014 17:10:59 -0400 Subject: [PATCH] =?UTF-8?q?:fire:=20=CF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #17674 --- src/doc/guide-lifetimes.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/doc/guide-lifetimes.md b/src/doc/guide-lifetimes.md index 66faee3fa04c..545d286c5d71 100644 --- a/src/doc/guide-lifetimes.md +++ b/src/doc/guide-lifetimes.md @@ -305,10 +305,9 @@ copying. # Circle(Point, f64), // origin, radius # Rectangle(Point, Size) // upper-left, dimensions # } -# static tau: f64 = 6.28; fn compute_area(shape: &Shape) -> f64 { match *shape { - Circle(_, radius) => 0.5 * tau * radius * radius, + Circle(_, radius) => 2.0 * std::f64::consts::PI * radius * radius, Rectangle(_, ref size) => size.w * size.h } } @@ -316,10 +315,7 @@ fn compute_area(shape: &Shape) -> f64 { The first case matches against circles. Here, the pattern extracts the radius from the shape variant and the action uses it to compute the -area of the circle. (Like any up-to-date engineer, we use the [tau -circle constant][tau] and not that dreadfully outdated notion of pi). - -[tau]: http://www.math.utah.edu/~palais/pi.html +area of the circle. The second match is more interesting. Here we match against a rectangle and extract its size: but rather than copy the `size`