D9109: rhg: use `.or(Err(Error))` not `.map_err(|_| Error)` (D9100#inline-15067)

acezar (Antoine Cezar) phabricator at mercurial-scm.org
Mon Sep 28 14:49:56 UTC 2020


acezar created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/rhg/src/commands/cat.rs

CHANGE DETAILS

diff --git a/rust/rhg/src/commands/cat.rs b/rust/rhg/src/commands/cat.rs
--- a/rust/rhg/src/commands/cat.rs
+++ b/rust/rhg/src/commands/cat.rs
@@ -40,9 +40,9 @@
             let normalized = cwd.join(&file);
             let stripped = normalized
                 .strip_prefix(&root)
-                .map_err(|_| CommandErrorKind::Abort(None))?;
+                .or(Err(CommandErrorKind::Abort(None)))?;
             let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
-                .map_err(|_| CommandErrorKind::Abort(None))?;
+                .or(Err(CommandErrorKind::Abort(None)))?;
             files.push(hg_file);
         }
 



To: acezar, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list