mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 20:14:32 -06:00
Fixing steve nits
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Rust's design has taken inspiration from a lot of previous work. One of Rust's
|
||||
influences is functional programming, where functions are values that can be
|
||||
used as arguments or return values to other functions, assigned to variables,
|
||||
and so forth. We're going to sidestep the issue of what, exactly, function
|
||||
and so forth. We're going to sidestep the issue of what, exactly, functional
|
||||
programming is or is not, and instead show off some features of Rust that
|
||||
are similar to features in many languages referred to as functional.
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ relevant parts:
|
||||
```rust
|
||||
fn add_one_v1 (x: i32) -> i32 { x + 1 } // a function
|
||||
let add_one_v2 = |x: i32| -> i32 { x + 1 }; // the full syntax for a closure
|
||||
let add_one_v3 = |x: i32| { x + 1 }; // a closure eliding types
|
||||
let add_one_v4 = |x: i32| x + 1 ; // without braces
|
||||
let add_one_v3 = |x| { x + 1 }; // a closure eliding types
|
||||
let add_one_v4 = |x| x + 1 ; // without braces
|
||||
```
|
||||
|
||||
The reason type annotations are not required for defining a closure but are
|
||||
|
||||
@@ -89,12 +89,12 @@ impl Config {
|
||||
let search = match args.next() {
|
||||
Some(arg) => arg,
|
||||
None => return Err("Didn't get a search string"),
|
||||
};
|
||||
};
|
||||
|
||||
let filename = match args.next() {
|
||||
Some(arg) => arg,
|
||||
None => return Err("Didn't get a file name"),
|
||||
};
|
||||
};
|
||||
|
||||
Ok(Config {
|
||||
search: search,
|
||||
|
||||
Reference in New Issue
Block a user