Skip to content

Commit

Permalink
Use try_fold in StarSettings::est_mem
Browse files Browse the repository at this point in the history
  • Loading branch information
sjackman committed Jul 9, 2024
1 parent 7179877 commit e4d83b0
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// Copyright (c) 2019 10x Genomics, Inc. All rights reserved.

use anyhow::{format_err, Error};
use rust_htslib::bam;
use rust_htslib::bam::header::{Header, HeaderRecord};
use rust_htslib::bam::HeaderView;
use star_sys::{self as bindings, Aligner as BindAligner, StarRef as BindRef};
use std::ffi::{CStr, CString};
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::os::raw::c_char;
use std::os::raw::c_int;
use std::os::raw::{c_char, c_int};
use std::path::Path;
use std::sync::Arc;

use anyhow::{format_err, Error};
use rust_htslib::bam;
use rust_htslib::bam::header::{Header, HeaderRecord};
use rust_htslib::bam::HeaderView;
use star_sys::{self as bindings, Aligner as BindAligner, StarRef as BindRef};

pub struct StarReference {
inner: Arc<InnerStarReference>,
}
Expand Down Expand Up @@ -141,8 +139,8 @@ impl StarSettings {
let refpath = Path::new(&self.reference_path);
["Genome", "SA", "SAindex"]
.iter()
.fold(Ok(0usize), |acc, file| {
Ok(acc? + std::fs::metadata(refpath.join(file))?.len() as usize)
.try_fold(0usize, |acc, file| {
Ok(acc + std::fs::metadata(refpath.join(file))?.len() as usize)
})
}
}
Expand Down

0 comments on commit e4d83b0

Please sign in to comment.