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(), + )) } }; 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-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::(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/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::())?; - 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(()) });