Run `cargo fmt` on `tests/test_sequence.rs`

This commit is contained in:
Martin Larralde 2019-03-29 23:17:07 +01:00
parent d482b715de
commit 3b7e83fb7c
1 changed files with 6 additions and 4 deletions

View File

@ -3,8 +3,8 @@ use pyo3::exceptions::IndexError;
use pyo3::exceptions::ValueError;
use pyo3::prelude::*;
use pyo3::types::IntoPyDict;
use pyo3::types::PyList;
use pyo3::types::PyAny;
use pyo3::types::PyList;
#[macro_use]
mod common;
@ -26,7 +26,9 @@ impl ByteSequence {
}
Self { elements: elems }
} else {
Self { elements: Vec::new() }
Self {
elements: Vec::new(),
}
});
Ok(())
}
@ -39,7 +41,8 @@ impl PySequenceProtocol for ByteSequence {
}
fn __getitem__(&self, idx: isize) -> PyResult<u8> {
self.elements.get(idx as usize)
self.elements
.get(idx as usize)
.map(|&byte| byte)
.ok_or(IndexError::py_err("list index out of range"))
}
@ -103,7 +106,6 @@ impl PySequenceProtocol for ByteSequence {
// }
}
#[test]
fn test_getitem() {
let gil = Python::acquire_gil();