# HG changeset patch # User Raphaël Gomès # Date 1561971018 -7200 # Node ID d26e4a434fe5181ff278ea71e1b19e6596328911 # Parent e3df1e15bee9d70d6cc4697e503091a7bff0f8fc rust: run rfmt on all hg-core/hg-cpython code Differential Revision: https://phab.mercurial-scm.org/D6591 diff -r e3df1e15bee9 -r d26e4a434fe5 rust/hg-core/src/dirstate/dirs_multiset.rs --- 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(), + )) } }; diff -r e3df1e15bee9 -r d26e4a434fe5 rust/hg-cpython/src/dagops.rs --- 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; diff -r e3df1e15bee9 -r d26e4a434fe5 rust/hg-cpython/src/exceptions.rs --- 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::(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 -r e3df1e15bee9 -r d26e4a434fe5 rust/hg-cpython/src/lib.rs --- 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::())?; - m.add(py, "PatternFileError", py.get_type::())?; - m.add(py, "PatternError", py.get_type::())?; + m.add( + py, + "PatternFileError", + py.get_type::(), + )?; + m.add( + py, + "PatternError", + py.get_type::(), + )?; Ok(()) });