diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs b/rust/hg-core/src/dirstate/dirs_multiset.rs index e3df1e15bee9d70d6cc4697e503091a7bff0f8fc_cnVzdC9oZy1jb3JlL3NyYy9kaXJzdGF0ZS9kaXJzX211bHRpc2V0LnJz..d26e4a434fe5181ff278ea71e1b19e6596328911_cnVzdC9oZy1jb3JlL3NyYy9kaXJzdGF0ZS9kaXJzX211bHRpc2V0LnJz 100644 --- 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 index e3df1e15bee9d70d6cc4697e503091a7bff0f8fc_cnVzdC9oZy1jcHl0aG9uL3NyYy9kYWdvcHMucnM=..d26e4a434fe5181ff278ea71e1b19e6596328911_cnVzdC9oZy1jcHl0aG9uL3NyYy9kYWdvcHMucnM= 100644 --- a/rust/hg-cpython/src/dagops.rs +++ b/rust/hg-cpython/src/dagops.rs @@ -9,5 +9,6 @@ //! `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}; @@ -12,6 +13,5 @@ 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 index e3df1e15bee9d70d6cc4697e503091a7bff0f8fc_cnVzdC9oZy1jcHl0aG9uL3NyYy9leGNlcHRpb25zLnJz..d26e4a434fe5181ff278ea71e1b19e6596328911_cnVzdC9oZy1jcHl0aG9uL3NyYy9leGNlcHRpb25zLnJz 100644 --- 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,8 +50,7 @@ } } - impl PatternFileError { pub fn pynew(py: Python, inner: hg::PatternFileError) -> PyErr { match inner { hg::PatternFileError::IO(e) => { @@ -54,10 +53,7 @@ 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) } @@ -62,7 +58,6 @@ 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)) } @@ -68,5 +63,5 @@ } - } + }, } } } diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs index e3df1e15bee9d70d6cc4697e503091a7bff0f8fc_cnVzdC9oZy1jcHl0aG9uL3NyYy9saWIucnM=..d26e4a434fe5181ff278ea71e1b19e6596328911_cnVzdC9oZy1jcHl0aG9uL3NyYy9saWIucnM= 100644 --- a/rust/hg-cpython/src/lib.rs +++ b/rust/hg-cpython/src/lib.rs @@ -28,5 +28,6 @@ mod cindex; mod conversion; pub mod dagops; +pub mod dirstate; pub mod discovery; pub mod exceptions; @@ -31,6 +32,5 @@ pub mod discovery; pub mod exceptions; -pub mod dirstate; pub mod filepatterns; py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| { @@ -45,5 +45,9 @@ 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>())?; @@ -49,5 +53,13 @@ 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(()) });