Patchwork D12174: rust: remove unused `StatusError::IO` enum variant

login
register
mail settings
Submitter phabricator
Date Feb. 14, 2022, 6:01 p.m.
Message ID <differential-rev-PHID-DREV-zpxwecpd5y3g4kbnsh24-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50509/
State New
Headers show

Comments

phabricator - Feb. 14, 2022, 6:01 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  All `io::Error` cases are now handled through PatternFileWarning or BadMatch

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/status.rs
  rust/hg-cpython/src/dirstate/status.rs

CHANGE DETAILS




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

Patch

diff --git a/rust/hg-cpython/src/dirstate/status.rs b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -10,7 +10,6 @@ 
 //! `rustext.dirstate.status`.
 
 use crate::{dirstate::DirstateMap, exceptions::FallbackError};
-use cpython::exc::OSError;
 use cpython::{
     exc::ValueError, ObjectProtocol, PyBytes, PyErr, PyList, PyObject,
     PyResult, PyTuple, Python, PythonObject, ToPyObject,
@@ -95,7 +94,6 @@ 
 
             PyErr::new::<FallbackError, _>(py, &as_string)
         }
-        StatusError::IO(e) => PyErr::new::<OSError, _>(py, e.to_string()),
         e => PyErr::new::<ValueError, _>(py, e.to_string()),
     }
 }
diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -128,8 +128,6 @@ 
 
 #[derive(Debug, derive_more::From)]
 pub enum StatusError {
-    /// Generic IO error
-    IO(std::io::Error),
     /// An invalid path that cannot be represented in Mercurial was found
     Path(HgPathError),
     /// An invalid "ignore" pattern was found
@@ -143,7 +141,6 @@ 
 impl fmt::Display for StatusError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
-            StatusError::IO(error) => error.fmt(f),
             StatusError::Path(error) => error.fmt(f),
             StatusError::Pattern(error) => error.fmt(f),
             StatusError::DirstateV2ParseError(_) => {