D7867: rust-hg-path: add useful methods to `HgPath`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 23 13:19:36 EST 2020


martinvonz added inline comments.

INLINE COMMENTS

> hg_path.rs:173
>      }
> -    pub fn join<T: ?Sized + AsRef<HgPath>>(&self, other: &T) -> HgPathBuf {
> +    pub fn trim_trailing_slash(&self) -> &Self {
> +        Self::new(if self.inner.last() == Some(&b'/') {

When do we create such paths? I can imagine using them for referring to directories. Is that it? If it's some other use-case, I wonder if we can instead prevent the trailing slash from entering the `HgPath`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


More information about the Mercurial-devel mailing list