From 1ece0058382c234dc64ce596eb62b1f636632566 Mon Sep 17 00:00:00 2001 From: Matthew Astley Date: Wed, 10 Jun 2015 10:59:36 +0100 Subject: [PATCH 1/2] trpl: why (assignment == empty tuple) #26120 --- src/doc/trpl/functions.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/doc/trpl/functions.md b/src/doc/trpl/functions.md index 21a29f00599..f2113031655 100644 --- a/src/doc/trpl/functions.md +++ b/src/doc/trpl/functions.md @@ -144,7 +144,9 @@ an expression, and a `let` can only begin a statement, not an expression. Note that assigning to an already-bound variable (e.g. `y = 5`) is still an expression, although its value is not particularly useful. Unlike other languages where an assignment evaluates to the assigned value (e.g. `5` in the -previous example), in Rust the value of an assignment is an empty tuple `()`: +previous example), in Rust the value of an assignment is an empty tuple `()` +because the assigned value can have (just one owner)[ownership.html], and any +other returned value would be too surprising: ```rust let mut y = 5; From aaf1983a5688683fa7514f273b86c030e9c7b92a Mon Sep 17 00:00:00 2001 From: Matthew Astley Date: Wed, 10 Jun 2015 16:15:24 +0100 Subject: [PATCH 2/2] mend bad Markdown --- src/doc/trpl/functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/functions.md b/src/doc/trpl/functions.md index f2113031655..ea927707ecd 100644 --- a/src/doc/trpl/functions.md +++ b/src/doc/trpl/functions.md @@ -145,7 +145,7 @@ Note that assigning to an already-bound variable (e.g. `y = 5`) is still an expression, although its value is not particularly useful. Unlike other languages where an assignment evaluates to the assigned value (e.g. `5` in the previous example), in Rust the value of an assignment is an empty tuple `()` -because the assigned value can have (just one owner)[ownership.html], and any +because the assigned value can have [just one owner](ownership.html), and any other returned value would be too surprising: ```rust