Make read_i64_from private and merge read_str_from to its caller

Also remove duplicated read_i64_from.

Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
Tim Zhang
2020-12-17 15:46:43 +08:00
parent e1e05d3a1c
commit e160df0751
2 changed files with 9 additions and 21 deletions

View File

@@ -17,6 +17,7 @@ use std::sync::mpsc::Receiver;
use crate::error::ErrorKind::*;
use crate::error::*;
use crate::events;
use crate::read_i64_from;
use crate::flat_keyed_to_hashmap;
@@ -880,17 +881,6 @@ fn read_u64_from(mut file: File) -> Result<u64> {
}
}
fn read_i64_from(mut file: File) -> Result<i64> {
let mut string = String::new();
match file.read_to_string(&mut string) {
Ok(_) => string
.trim()
.parse()
.map_err(|e| Error::with_cause(ParseError, e)),
Err(e) => Err(Error::with_cause(ReadFailed, e)),
}
}
fn read_string_from(mut file: File) -> Result<String> {
let mut string = String::new();
match file.read_to_string(&mut string) {