Mercurial > hg
changeset 44926:14125dec0e39
rust: leverage .expect() in place of .unwrap() + inline comment
For a better error indication in case we made a mistake.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 25 May 2020 23:06:50 +0900 |
parents | ce8fe77102f4 |
children | 472b14da52c2 |
files | rust/hg-core/src/dirstate/status.rs |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/status.rs Mon May 25 23:02:07 2020 +0900 +++ b/rust/hg-core/src/dirstate/status.rs Mon May 25 23:06:50 2020 +0900 @@ -257,11 +257,9 @@ } else { if file_type.is_dir() { if options.collect_traversed_dirs { - // The receiver always outlives the sender, - // so unwrap. traversed_sender .send(normalized.to_owned()) - .unwrap() + .expect("receiver should outlive sender"); } Some(Ok(( normalized, @@ -471,8 +469,9 @@ let directory = directory.as_ref(); if options.collect_traversed_dirs { - // The receiver always outlives the sender, so unwrap. - traversed_sender.send(directory.to_owned()).unwrap() + traversed_sender + .send(directory.to_owned()) + .expect("receiver should outlive sender"); } let visit_entries = match matcher.visit_children_set(directory) {