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

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


kevincox added inline comments.

INLINE COMMENTS

> filepatterns.rs:220
> +        initial_slashes = 2;
> +    }
> +    let components =

It might be clearer to do `bytes.iter().take_while(|b| b == sep).count()`

> filepatterns.rs:237
> +                acc
> +            });
> +    let mut new_bytes = components.join(&sep);

Personally I think this would be more clear as a `for` loop.

> filepatterns.rs:250
> +    }
> +}
> +

Should this be part of HgPathBuf  or is this normalization specific to the file pattern matching in some way?

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