Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-cpython/src/exceptions.rs @ 42560: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 | 94f3a73b6672 |
children | 326fdce22fb2 |
line wrap: on
line diff
--- 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)) } - } + }, } } }