-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
54 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Ran dprint fmt on the repo | ||
3a30e4c1 | ||
3a30e4c1fbe641afc066b3af9eb01dcdf5ed8b24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
rustbook-en/listings/ch11-writing-automated-tests/listing-11-03/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
pub fn add(left: u64, right: u64) -> u64 { | ||
left + right | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...book-en/listings/ch11-writing-automated-tests/no-listing-01-changing-test-name/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
pub fn add(left: u64, right: u64) -> u64 { | ||
left + right | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
rustbook-en/listings/ch11-writing-automated-tests/no-listing-10-result-in-tests/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
pub fn add(left: u64, right: u64) -> u64 { | ||
left + right | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
rustbook-en/listings/ch11-writing-automated-tests/no-listing-11-ignore-a-test/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
pub fn add(left: u64, right: u64) -> u64 { | ||
left + right | ||
} | ||
|
||
|
20 changes: 0 additions & 20 deletions
20
rustbook-en/listings/ch20-advanced-features/no-listing-18-returns-closure/output.txt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
rustbook-en/listings/ch20-advanced-features/no-listing-18-returns-closure/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fn returns_closure() -> dyn Fn(i32) -> i32 { | ||
fn returns_closure() -> impl Fn(i32) -> i32 { | ||
|x| x + 1 | ||
} |
3 changes: 0 additions & 3 deletions
3
...-en/listings/ch20-advanced-features/no-listing-19-returns-closure-trait-object/src/lib.rs
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...en/listings/ch20-advanced-features/no-listing-19-returns-closure-trait-object/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
fn main() { | ||
let handlers = vec![returns_closure(), returns_initialized_closure(123)]; | ||
for handler in handlers { | ||
let output = handler(5); | ||
println!("{output}"); | ||
} | ||
} | ||
|
||
fn returns_closure() -> Box<dyn Fn(i32) -> i32> { | ||
Box::new(|x| x + 1) | ||
} | ||
|
||
fn returns_initialized_closure(init: i32) -> Box<dyn Fn(i32) -> i32> { | ||
Box::new(move |x| x + init) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters