mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
Simplify a few Option / Result pattern-matches
This commit is contained in:
@ -23,9 +23,6 @@ impl std::error::Error for PyError {}
|
||||
pub struct ToPyResult<T>(pub Result<T>);
|
||||
impl<T> std::convert::Into<PyResult<T>> for ToPyResult<T> {
|
||||
fn into(self) -> PyResult<T> {
|
||||
match self.0 {
|
||||
Ok(o) => Ok(o),
|
||||
Err(e) => Err(exceptions::Exception::py_err(format!("{}", e))),
|
||||
}
|
||||
self.0.map_err(|e| { exceptions::Exception::py_err(format!("{}", e)) })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user