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

login
register
mail settings
Submitter phabricator
Date Sept. 28, 2020, 2:49 p.m.
Message ID <differential-rev-PHID-DREV-p3zm2c3bbgeiffci67rc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47324/
State Superseded
Headers show

Comments

phabricator - Sept. 28, 2020, 2:49 p.m.
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




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

Patch

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);
         }