Skip to content

Commit 5ea3d30

Browse files
committed
Remove most remaining lambda references
1 parent 156a7f8 commit 5ea3d30

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/expressions.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ also constant expressions:
179179
* [Index expressions](#index-expressions), indexing a [array or
180180
slice](types.html#array-and-slice-types) with a `usize`.
181181
* [Range expressions](#range-expressions).
182-
* [Lambda expressions](#lambda-expressions) which don't capture variables from
182+
* [Closure expressions](#closure-expressions) which don't capture variables from
183183
the environment.
184184
* Built in [negation](#negation-operators), [arithmetic,
185185
logical](#arithmetic-and-logical-binary-operators),
@@ -571,29 +571,29 @@ Refer to [RFC 132] for further details and motivations.
571571

572572
[RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md
573573

574-
## Lambda expressions
574+
## Closure expressions
575575

576-
A _lambda expression_ (sometimes called an "anonymous function expression")
577-
defines a closure and denotes it as a value, in a single expression. A lambda
576+
A _closure expression_ (sometimes called an "anonymous function expression")
577+
defines a closure and denotes it as a value, in a single expression. A closure
578578
expression is a pipe-symbol-delimited (`|`) list of patterns followed by an
579579
expression. Type annotations may optionally be added for the type of the
580580
parameters or for the return type. If there is a return type, the expression
581-
used for the body of the lambda must be a normal [block](#block-expressions). A
582-
lambda expression also may begin with the `move` keyword before the initial
581+
used for the body of the closure must be a normal [block](#block-expressions).
582+
A closure expression also may begin with the `move` keyword before the initial
583583
`|`.
584584

585-
A lambda expression denotes a function that maps a list of parameters
585+
A closure expression denotes a function that maps a list of parameters
586586
(`ident_list`) onto the expression that follows the `ident_list`. The patterns
587587
in the `ident_list` are the parameters to the closure. If a parameter's types
588588
is not specified, then the compiler infers it from context. Each closure
589589
expression has a unique anonymous type.
590590

591-
Lambda expressions are most useful when passing functions as arguments to other
591+
Closure expressions are most useful when passing functions as arguments to other
592592
functions, as an abbreviation for defining and capturing a separate function.
593593

594-
Significantly, lambda expressions _capture their environment_, which regular
594+
Significantly, closure expressions _capture their environment_, which regular
595595
[function definitions](items.html#functions) do not. Without the `move`
596-
keyword, the lambda expression infers how it captures each variable from its
596+
keyword, the closure expression infers how it captures each variable from its
597597
environment, preferring to capture by shared reference, effectively borrowing
598598
all outer variables mentioned inside the closure's body. If needed the compiler
599599
will infer that instead mutable references should be taken, or that the values
@@ -610,8 +610,8 @@ traits allow functions to accept closures using generics, even though the exact
610610
types can't be named.
611611

612612
In this example, we define a function `ten_times` that takes a higher-order
613-
function argument, and we then call it with a lambda expression as an argument,
614-
followed by a lambda expression that moves values from its environment.
613+
function argument, and we then call it with a closure expression as an argument,
614+
followed by a closure expression that moves values from its environment.
615615

616616
```rust
617617
fn ten_times<F>(f: F) where F: Fn(i32) {
@@ -1069,7 +1069,7 @@ rather than are evaluated, so probably shouldn't be here. -->
10691069
| `..` `...` | Require parentheses |
10701070
| `<-` | right to left |
10711071
| `=` `+=` `-=` `*=` `/=` `%=` `&=` <code>&#124;=</code> `^=` `<<=` `>>=` | right to left |
1072-
| `return` `break` `continue`<br>Lambda expressions | right to left |
1072+
| `return` `break` `continue`<br>Closure expressions | right to left |
10731073

10741074

10751075
## Grouped expressions

0 commit comments

Comments
 (0)