Last active
October 5, 2022 10:49
-
-
Save shubhamkumar13/55b1da4c3ed5ff8d83c7458693d69007 to your computer and use it in GitHub Desktop.
after_improved_code
This file contains hidden or 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
| // find the nearest cab in the fleet from the person | |
| let mut nearest_cab = fleet | |
| .into_iter() | |
| .filter(|x| is_free((*x).clone()).is_ok()) | |
| .reduce(|c1, c2| person.nearest_cab(&c1, &c2)) | |
| .and_then(|x| Some(x.clone())) | |
| .expect("Unable to get the nearest cab"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment