D7792: rust-nodemap: abstracting the indexing

kevincox (Kevin Cox) phabricator at mercurial-scm.org
Thu Jan 16 05:10:58 EST 2020


kevincox added inline comments.
kevincox accepted this revision.

INLINE COMMENTS

> nodemap.rs:192
>      ) -> Result<Option<Revision>, NodeMapError> {
> -        let blocks: &[Block] = &*self.readonly;
> -        if blocks.is_empty() {
> +        let len = self.len();
> +        if len == 0 {

I don't think this variable helps readability. I would just repeat `self.len()`.

> nodemap.rs:193
> +        let len = self.len();
> +        if len == 0 {
>              return Ok(None);

I would add a `self.is_empty()` helper. It's good practice for anything that has a `.len()`.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7792/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7792

To: gracinet, #hg-reviewers, kevincox
Cc: durin42, kevincox, mercurial-devel


More information about the Mercurial-devel mailing list