D7908: rust-filepatterns: improve API and robustness for pattern files parsing

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Thu Jan 16 13:41:26 EST 2020


Alphare added inline comments.
Alphare marked an inline comment as done.

INLINE COMMENTS

> kevincox wrote in filepatterns.rs:220
> It might be clearer to do `bytes.iter().take_while(|b| b == sep).count()`

Indeed. Also added a comment to explain the reasoning.

> kevincox wrote in filepatterns.rs:237
> Personally I think this would be more clear as a `for` loop.

I'm not sure I agree. On the basis that "Rust might optimize iterators better than for loops" I vote to keep it that way.

> kevincox wrote in filepatterns.rs:250
> Should this be part of HgPathBuf  or is this normalization specific to the file pattern matching in some way?

For now this is pretty specific, but it might need to be moved later when more code paths use it.

REPOSITORY
  rHG Mercurial

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

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

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


More information about the Mercurial-devel mailing list