changeset 42557:d26e4a434fe5

rust: run rfmt on all hg-core/hg-cpython code Differential Revision: https://phab.mercurial-scm.org/D6591
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 01 Jul 2019 10:50:18 +0200
parents e3df1e15bee9
children 11c025c83393
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
diffstat 4 files changed, 31 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs	Mon Jul 01 16:25:51 2019 -0700
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs	Mon Jul 01 10:50:18 2019 +0200
@@ -118,7 +118,9 @@
                     entry.remove();
                 }
                 Entry::Vacant(_) => {
-                    return Err(DirstateMapError::PathNotFound(path.to_owned()))
+                    return Err(DirstateMapError::PathNotFound(
+                        path.to_owned(),
+                    ))
                 }
             };
 
--- a/rust/hg-cpython/src/dagops.rs	Mon Jul 01 16:25:51 2019 -0700
+++ b/rust/hg-cpython/src/dagops.rs	Mon Jul 01 10:50:18 2019 +0200
@@ -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;
--- a/rust/hg-cpython/src/exceptions.rs	Mon Jul 01 16:25:51 2019 -0700
+++ b/rust/hg-cpython/src/exceptions.rs	Mon Jul 01 10:50:18 2019 +0200
@@ -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))
                 }
-            }
+            },
         }
     }
 }
--- a/rust/hg-cpython/src/lib.rs	Mon Jul 01 16:25:51 2019 -0700
+++ b/rust/hg-cpython/src/lib.rs	Mon Jul 01 10:50:18 2019 +0200
@@ -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(())
 });