]> git.lizzy.rs Git - rust.git/commitdiff
Guide: Fix use of sqrt() in example
authorDaniel Hofstetter <daniel.hofstetter@42dh.com>
Tue, 28 Oct 2014 15:09:14 +0000 (16:09 +0100)
committerDaniel Hofstetter <daniel.hofstetter@42dh.com>
Tue, 28 Oct 2014 15:09:14 +0000 (16:09 +0100)
src/doc/guide-lifetimes.md

index dd79d63d514536425e58df0ca8c0cc76dffdb282..b6ea1ddb3949d3e3d7c83a1558a275ae546ed770 100644 (file)
@@ -56,7 +56,7 @@ a reference.
 fn compute_distance(p1: &Point, p2: &Point) -> f64 {
     let x_d = p1.x - p2.x;
     let y_d = p1.y - p2.y;
-    sqrt(x_d * x_d + y_d * y_d)
+    (x_d * x_d + y_d * y_d).sqrt()
 }
 ~~~