Skip to content

Commit

Permalink
Use path.display()
Browse files Browse the repository at this point in the history
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
  • Loading branch information
benjyw committed Sep 11, 2020
1 parent 790e5c4 commit f256ffc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/rust/engine/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,23 @@ impl Core {
let mut content = String::new();
std::fs::File::open(path)
.and_then(|mut f| f.read_to_string(&mut content))
.map_err(|err| format!("Error reading root CA certs file {:?}: {}", path, err))?;
.map_err(|err| {
format!(
"Error reading root CA certs file {}: {}",
path.display(),
err
)
})?;
let pem_re = Regex::new(PEM_RE_STR).unwrap();
let certs_res: Result<Vec<reqwest::Certificate>, _> = pem_re
.find_iter(&content)
.map(|mat| reqwest::Certificate::from_pem(mat.as_str().as_bytes()))
.collect();
certs_res.map_err(|err| {
format!(
"Error parsing PEM from root CA certs file {:?}: {}",
path, err
"Error parsing PEM from root CA certs file {}: {}",
path.display(),
err
)
})?
} else {
Expand Down

0 comments on commit f256ffc

Please sign in to comment.