D5945: rust: itering less on MissingAncestors.bases for max()
kevincox (Kevin Cox)
phabricator at mercurial-scm.org
Sat Feb 16 01:37:58 EST 2019
kevincox added inline comments.
INLINE COMMENTS
> ancestors.rs:347
> }
> -
> - let max_bases =
> - bases_visit.iter().cloned().max().unwrap_or(NULL_REVISION);
> - let max_revs =
> - revs_visit.iter().cloned().max().unwrap_or(NULL_REVISION);
> - let start = max(max_bases, max_revs);
> + let max_revs = revs_visit.iter().cloned().max().unwrap();
> + let start = max(self.max_base, max_revs);
You are doing an empty check and an unwrap. I think it would be nice to combine these to make it obvious that there is no panic chance here.
let max_revs = revs_visit.iter().cloned().max();
let max_revs = match max_revs {
Some(max) => max,
None => return Ok(Vec::new()),
};
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5945
To: gracinet, #hg-reviewers, kevincox
Cc: durin42, kevincox, mercurial-devel
More information about the Mercurial-devel
mailing list