D6629: rust-dirstate: use EntryState enum instead of literals

kevincox (Kevin Cox) phabricator at mercurial-scm.org
Mon Jul 15 12:08:06 EDT 2019


kevincox added inline comments.
kevincox accepted this revision.

INLINE COMMENTS

> lib.rs:85
> +            Overflow => "Overflow in dirstate.".to_string(),
> +            CorruptedEntry(e) => format!("Corrupted entry: {}.", e),
> +            Damaged => "Dirstate appears to be damaged.".to_string(),

I like using `{!r}` so that the substituted entry is quoted and unambiguous.

> parsers.rs:42
> +                // platform-specific `c_char`.
> +                let state: u8 = entry.state.into();
> +

If you are going to a comment I would say why. However in this case it probably isn't worth having a comment.

You can also do this on one line `entry.state.into::<u8>() as c_char` which I think is simple enough.

REPOSITORY
  rHG Mercurial

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

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

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


More information about the Mercurial-devel mailing list