Skip to content

Commit bc050dd

Browse files
authored
Use try_fold in StarSettings::est_mem (#79)
1 parent 229c22a commit bc050dd

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/lib.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
// Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
22

3+
use anyhow::{format_err, Error};
4+
use rust_htslib::bam;
5+
use rust_htslib::bam::header::{Header, HeaderRecord};
6+
use rust_htslib::bam::HeaderView;
7+
use star_sys::{self as bindings, Aligner as BindAligner, StarRef as BindRef};
38
use std::ffi::{CStr, CString};
49
use std::fs::File;
510
use std::io::prelude::*;
611
use std::io::BufReader;
7-
use std::os::raw::c_char;
8-
use std::os::raw::c_int;
12+
use std::os::raw::{c_char, c_int};
913
use std::path::Path;
1014
use std::sync::Arc;
1115

12-
use anyhow::{format_err, Error};
13-
use rust_htslib::bam;
14-
use rust_htslib::bam::header::{Header, HeaderRecord};
15-
use rust_htslib::bam::HeaderView;
16-
use star_sys::{self as bindings, Aligner as BindAligner, StarRef as BindRef};
17-
1816
pub struct StarReference {
1917
inner: Arc<InnerStarReference>,
2018
}
@@ -141,8 +139,8 @@ impl StarSettings {
141139
let refpath = Path::new(&self.reference_path);
142140
["Genome", "SA", "SAindex"]
143141
.iter()
144-
.fold(Ok(0usize), |acc, file| {
145-
Ok(acc? + std::fs::metadata(refpath.join(file))?.len() as usize)
142+
.try_fold(0usize, |acc, file| {
143+
Ok(acc + std::fs::metadata(refpath.join(file))?.len() as usize)
146144
})
147145
}
148146
}

0 commit comments

Comments
 (0)