Fix read_single parsing failure due to \n

This commit is contained in:
NGnius (Graham) 2022-06-20 20:16:44 -04:00
parent 248c5837b5
commit becfe89299
2 changed files with 2 additions and 2 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "usdpl-back"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
license = "GPL-3.0-only"
repository = "https://github.com/NGnius/usdpl-rs"

View file

@ -18,5 +18,5 @@ pub fn read_single<P: AsRef<Path>, D: FromStr<Err=E>, E>(path: P) -> Result<D, (
let mut file = File::create(path).map_err(|e| (Some(e), None))?;
let mut string = String::new();
file.read_to_string(&mut string).map_err(|e| (Some(e), None))?;
string.parse().map_err(|e| (None, Some(e)))
string.trim().parse().map_err(|e| (None, Some(e)))
}