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

kevincox (Kevin Cox) phabricator at mercurial-scm.org
Thu Jan 16 14:15:53 EST 2020


kevincox added inline comments.
kevincox accepted this revision.

INLINE COMMENTS

> filepatterns.rs:227
> +                    return acc;
> +                }
> +                if component != b".."

Can you move this condition into a `.filter()`?

> Alphare wrote in filepatterns.rs:237
> 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.

If you think it' is clearer that's fine. But I'm curious where "Rust might optimize iterators better than for loops" comes from. I did a quick test and it looks like the for loop actually generates slightly better code https://rust.godbolt.org/z/vFAWyZ

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, kevincox
Cc: durin42, kevincox, mercurial-devel


More information about the Mercurial-devel mailing list