Skip to content

Commit 83953b3

Browse files
author
Hang Ji
committed
format
1 parent 0b58d74 commit 83953b3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

flatgfa-py/src/lib.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use std::sync::Arc;
1515
/// This may be either an in-memory data structure or a memory-mapped file. It exposes a
1616
/// uniform interface to the FlatGFA data via `view`.
1717
///
18-
1918
enum Store {
2019
Heap(Box<HeapGFAStore>),
2120
File(memmap::Mmap),
@@ -135,11 +134,11 @@ impl PyFlatGFA {
135134
fn load_gaf(&self, gaf: &str) -> PyGAFParser {
136135
let gfa = self.0.view();
137136
let name_map = flatgfa::namemap::NameMap::build(&gfa);
138-
let gaf_buf = Arc::new(flatgfa::memfile::map_file(&gaf));
137+
let gaf_buf = Arc::new(flatgfa::memfile::map_file(gaf));
139138
PyGAFParser {
140139
gaf_buf: OwnedGAFParser { mmap: gaf_buf },
141140
store: self.0.clone(),
142-
name_map: name_map,
141+
name_map,
143142
pos: 0,
144143
}
145144
}
@@ -186,7 +185,7 @@ impl ListRef {
186185
{
187186
match arg {
188187
SliceOrInt::Slice(slice) => {
189-
let indices = slice.indices(self.len().try_into().unwrap())?;
188+
let indices = slice.indices(self.len().into())?;
190189
if indices.step == 1 {
191190
Ok(L::from(self.slice(indices.start as u32, indices.stop as u32)).into_py(py))
192191
} else {
@@ -536,9 +535,9 @@ struct OwnedGAFParser {
536535
mmap: Arc<Mmap>,
537536
}
538537
impl OwnedGAFParser {
539-
fn view_gafparser<'a>(&'a self, position: usize) -> GAFParser<'a> {
538+
fn view_gafparser(&self, position: usize) -> GAFParser<'_> {
540539
let sub_slice = &self.mmap[position..];
541-
flatgfa::ops::gaf::GAFParser::new(&sub_slice)
540+
flatgfa::ops::gaf::GAFParser::new(sub_slice)
542541
}
543542
}
544543

@@ -571,10 +570,9 @@ impl PyGAFParser {
571570
&self.name_map,
572571
chunk,
573572
)
574-
.into_iter()
575573
.map(|c| PyChunkEvent {
576574
store: self.store.clone(),
577-
chunk_event: c.into(),
575+
chunk_event: c,
578576
})
579577
.collect(),
580578
});
@@ -686,7 +684,7 @@ impl StepList {
686684
fn __getitem__(&self, arg: SliceOrInt, py: Python) -> PyResult<PyObject> {
687685
match arg {
688686
SliceOrInt::Slice(slice) => {
689-
let indices = slice.indices(self.0.len().try_into().unwrap())?;
687+
let indices = slice.indices(self.0.len().into())?;
690688
if indices.step == 1 {
691689
let list = self.0.slice(indices.start as u32, indices.stop as u32);
692690
Ok(Self(list).into_py(py))

0 commit comments

Comments
 (0)