diff --git a/ch05-02-method-syntax.html b/ch05-02-method-syntax.html index b61af0c0a..71555b03a 100644 --- a/ch05-02-method-syntax.html +++ b/ch05-02-method-syntax.html @@ -222,7 +222,7 @@ reference. Yet, we needed a & for p2 but not This feature is called ‘automatic referencing’, and calling methods is one of the few places in Rust that has behavior like this. Here’s how it works: when you call a method with self.(, Rust will automatically add in &s -or &muts to match the signature. In other words, these are the same:

+or &muts to match the signature. In other words, these three are the same:

# #[derive(Debug,Copy,Clone)]
 # struct Point {
 #     x: f64,
@@ -241,6 +241,7 @@ or &muts to match the signature. In other words, these are the
 # let p2 = Point { x: 5.0, y: 6.5 };
 p1.distance(&p2);
 (&p1).distance(&p2);
+Point::distance(&p1, &p2);
 

The first one looks much, much cleaner. Here’s another example:

let mut s = String::from("Hello,");
diff --git a/print.html b/print.html
index 1e2a64636..6b4ad366f 100644
--- a/print.html
+++ b/print.html
@@ -2950,7 +2950,7 @@ reference. Yet, we needed a & for p2 but not This feature is called ‘automatic referencing’, and calling methods is one
 of the few places in Rust that has behavior like this. Here’s how it works:
 when you call a method with self.(, Rust will automatically add in &s
-or &muts to match the signature. In other words, these are the same:

+or &muts to match the signature. In other words, these three are the same:

# #[derive(Debug,Copy,Clone)]
 # struct Point {
 #     x: f64,
@@ -2969,6 +2969,7 @@ or &muts to match the signature. In other words, these are the
 # let p2 = Point { x: 5.0, y: 6.5 };
 p1.distance(&p2);
 (&p1).distance(&p2);
+Point::distance(&p1, &p2);
 

The first one looks much, much cleaner. Here’s another example:

let mut s = String::from("Hello,");