1
Fork 0

Drop json::from_reader

Performing UTF-8 decode outside the JSON module makes more sense in almost all cases.
This commit is contained in:
Mark Rousskov 2022-02-05 14:50:46 -05:00
parent cb18e83e85
commit 0fb2b7a2da
2 changed files with 2 additions and 24 deletions

View file

@ -2145,8 +2145,8 @@ impl Target {
use std::fs;
fn load_file(path: &Path) -> Result<(Target, TargetWarnings), String> {
let contents = fs::read(path).map_err(|e| e.to_string())?;
let obj = json::from_reader(&mut &contents[..]).map_err(|e| e.to_string())?;
let contents = fs::read_to_string(path).map_err(|e| e.to_string())?;
let obj = json::from_str(&contents).map_err(|e| e.to_string())?;
Target::from_json(obj)
}