Change:
# Patterns <ins> We've made use of patterns a few times in the guide: first with `let` bindings, then with `match` statements. Let's go on a whirlwind tour of all of the things patterns can do! A quick refresher: you can match against literals directly, and `_` acts as an 'any' case: ```{rust} let x = 1i; match x { 1 => println!("one"), 2 => println!("two"), 3 => println!("three"), _ => println!("anything"), } ``` You can match multiple patterns with `|`: ```{rust} let x = 1i; match x { 1 | 2 => println!("one or two"), 3 => println!("three"), _ => println!("anything"), } ``` You can match a range of values with `..`: ```{rust} let x = 1i; match x { 1 .. 5 => println!("one through five"), _ => println!("anything"), } ``` Ranges are mostly used with integers and single characters. If you're matching multiple things, via a `|` or a `..`, you can bind the value to a name with `@`: ```{rust} let x = 1i; match x { x @ 1 .. 5 => println!("got {}", x), _ => println!("anything"), } ``` If you're matching on an enum which has variants, you can use `..` to ignore the value in the variant: ```{rust} enum OptionalInt { Value(int), Missing, } let x = Value(5i); match x { Value(..) => println!("Got an int!"), Missing   => println!("No such luck."), } ``` You can introduce **match guards** with `if`: ```{rust} enum OptionalInt { Value(int), Missing, } let x = Value(5i); match x { Value(x) if x > 5 => println!("Got an int bigger than five!"), Value(..) => println!("Got an int!"), Missing   => println!("No such luck."), } ``` If you're matching on a pointer, you can use the same syntax as you declared it with. First, `&`: ```{rust} let x = &5i; match x { &x => println!("Got a value: {}", x), } ``` Here, the `x` inside the `match` has type `int`. In other words, the left hand side of the pattern destructures the value. If we have `&5i`, then in `&x`, `x` would be `5i`. If you want to get a reference, use the `ref` keyword: ```{rust} let x = 5i; match x { ref x => println!("Got a reference to {}", x), } ``` Here, the `x` inside the `match` has the type `&int`. In other words, the `ref` keyword _creates_ a reference, for use in the pattern. If you need a mutable reference, `ref mut` will work in the same way: ```{rust} let mut x = 5i; match x { ref mut x => println!("Got a mutable reference to {}", x), } ``` If you have a struct, you can desugar it inside of a pattern: ```{rust} struct Point { x: int, y: int, } let origin = Point { x: 0i, y: 0i }; match origin { Point { x: x, y: y } => println!("({},{})", x, y), } ``` If we only care about some of the values, we don't have to give them all names: ```{rust} struct Point { x: int, y: int, } let origin = Point { x: 0i, y: 0i }; match origin { Point { x: x, .. } => println!("x is {}", x), } ``` Whew! That's a lot of different ways to match things, and they can all be mixed and matched, depending on what you're doing: ```{rust,ignore} match x { Foo { x: Some(ref name), y: None } => ... } ``` Patterns are very powerful.  Make good use of them. </ins> # Method Syntax Functions are great, but if you want to call a bunch of them on some data, it

Discussion:
The explanation of argument patterns in closures is pretty dense. Maybe it could be explained better by comparing to a match statement. See
And also patterns
part of
So much of this has changed, both with , and with closures, that I don't know if this issue is still relevant. is it?
there are a family of potential problems that are flagged in the reddit discussion. Here are the ones that I can identify with a quick skim: The original poster did not see that the syntax within the closure's arguments was a pattern binding that performs a dereference of the input, The fact that the closure itself takes a reference as input might be obscured by the fact that the closure doesn't have an explicit type signature (at least, that was one of huon's theories in his comment), brson interpreted the discussion as a sign that drawing an analogy between and the arguments to a could be helpful. (But 's comment points out that the patterns for arguments need to be irrefutable, which is an important distinction and thus I am not 100% sure an analogy with will help.) I'm not sure if this particular ticket is actionable on its own. I would want to make sure that the guide covers the fact that means one thing in expression context (namely, "make a reference to the l-value ") and another thing in pattern context (namely, "dereference the input and bind the resulting value to "). We cannot put that into the "Variable bindings" section of the current guide, since that precedes the section on "Pointers", but maybe just make sure that there is a TODO in the "Pointers" section that ensures we cover the distinction between an expression and an pattern.
Cool. Agreed. Since I'm working on pointers right now, that's very timely! cc
I actually think I'm just going to make patterns their own section, after pointers. We haven't talked about anything more than just very basic usage, and at the very least deserves an explanation
that is probably best; there are a lot of subtle details in terms of the distinction between how l-values are handled versus r-values.