mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-21 19:13:07 +00:00
optimize variable: min -> max (#534)
This commit is contained in:
parent
ad5f968c89
commit
d3a407a433
1 changed files with 3 additions and 3 deletions
|
@ -32,10 +32,10 @@ fn find_max(arr: &[i32]) -> Option<i32> {
|
|||
let thread_l = s.spawn(|_| find_max(left));
|
||||
let thread_r = s.spawn(|_| find_max(right));
|
||||
|
||||
let min_l = thread_l.join().unwrap()?;
|
||||
let min_r = thread_r.join().unwrap()?;
|
||||
let max_l = thread_l.join().unwrap()?;
|
||||
let max_r = thread_r.join().unwrap()?;
|
||||
|
||||
Some(min_l.max(min_r))
|
||||
Some(max_l.max(max_r))
|
||||
}).unwrap()
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue