D6591: rust-minor-fixes: run rfmt on all hg-core/hg-cpython code

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Thu Jul 4 14:59:30 UTC 2019


Alphare created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirs_multiset.rs
  rust/hg-cpython/src/dagops.rs
  rust/hg-cpython/src/exceptions.rs
  rust/hg-cpython/src/lib.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs
--- a/rust/hg-cpython/src/lib.rs
+++ b/rust/hg-cpython/src/lib.rs
@@ -28,9 +28,9 @@
 mod cindex;
 mod conversion;
 pub mod dagops;
+pub mod dirstate;
 pub mod discovery;
 pub mod exceptions;
-pub mod dirstate;
 pub mod filepatterns;
 
 py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| {
@@ -45,9 +45,21 @@
     m.add(py, "dagop", dagops::init_module(py, &dotted_name)?)?;
     m.add(py, "discovery", discovery::init_module(py, &dotted_name)?)?;
     m.add(py, "dirstate", dirstate::init_module(py, &dotted_name)?)?;
-    m.add(py, "filepatterns", filepatterns::init_module(py, &dotted_name)?)?;
+    m.add(
+        py,
+        "filepatterns",
+        filepatterns::init_module(py, &dotted_name)?,
+    )?;
     m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?;
-    m.add(py, "PatternFileError", py.get_type::<exceptions::PatternFileError>())?;
-    m.add(py, "PatternError", py.get_type::<exceptions::PatternError>())?;
+    m.add(
+        py,
+        "PatternFileError",
+        py.get_type::<exceptions::PatternFileError>(),
+    )?;
+    m.add(
+        py,
+        "PatternError",
+        py.get_type::<exceptions::PatternError>(),
+    )?;
     Ok(())
 });
diff --git a/rust/hg-cpython/src/exceptions.rs b/rust/hg-cpython/src/exceptions.rs
--- a/rust/hg-cpython/src/exceptions.rs
+++ b/rust/hg-cpython/src/exceptions.rs
@@ -12,8 +12,8 @@
 //! existing Python exceptions if appropriate.
 //!
 //! [`GraphError`]: struct.GraphError.html
-use cpython::exc::{ValueError, RuntimeError};
-use cpython::{PyErr, Python, exc};
+use cpython::exc::{RuntimeError, ValueError};
+use cpython::{exc, PyErr, Python};
 use hg;
 
 py_exception!(rustext, GraphError, ValueError);
@@ -28,10 +28,10 @@
                 match py
                     .import("mercurial.error")
                     .and_then(|m| m.get(py, "WdirUnsupported"))
-                    {
-                        Err(e) => e,
-                        Ok(cls) => PyErr::from_instance(py, cls),
-                    }
+                {
+                    Err(e) => e,
+                    Ok(cls) => PyErr::from_instance(py, cls),
+                }
             }
         }
     }
@@ -50,23 +50,18 @@
     }
 }
 
-
 impl PatternFileError {
     pub fn pynew(py: Python, inner: hg::PatternFileError) -> PyErr {
         match inner {
             hg::PatternFileError::IO(e) => {
-                let value = (
-                    e.raw_os_error().unwrap_or(2),
-                    e.to_string()
-                );
+                let value = (e.raw_os_error().unwrap_or(2), e.to_string());
                 PyErr::new::<exc::IOError, _>(py, value)
             }
-            hg::PatternFileError::Pattern(e, l) => {
-                match e {
-                    hg::PatternError::UnsupportedSyntax(m) =>
-                        PatternFileError::new(py, ("PatternFileError", m, l))
+            hg::PatternFileError::Pattern(e, l) => match e {
+                hg::PatternError::UnsupportedSyntax(m) => {
+                    PatternFileError::new(py, ("PatternFileError", m, l))
                 }
-            }
+            },
         }
     }
 }
diff --git a/rust/hg-cpython/src/dagops.rs b/rust/hg-cpython/src/dagops.rs
--- a/rust/hg-cpython/src/dagops.rs
+++ b/rust/hg-cpython/src/dagops.rs
@@ -9,9 +9,9 @@
 //! `hg-core` package.
 //!
 //! From Python, this will be seen as `mercurial.rustext.dagop`
+use crate::conversion::{py_set, rev_pyiter_collect};
 use cindex::Index;
 use cpython::{PyDict, PyModule, PyObject, PyResult, Python};
-use crate::conversion::{py_set, rev_pyiter_collect};
 use exceptions::GraphError;
 use hg::dagops;
 use hg::Revision;
diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -118,7 +118,9 @@
                     entry.remove();
                 }
                 Entry::Vacant(_) => {
-                    return Err(DirstateMapError::PathNotFound(path.to_owned()))
+                    return Err(DirstateMapError::PathNotFound(
+                        path.to_owned(),
+                    ))
                 }
             };
 



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


More information about the Mercurial-devel mailing list