Mercurial > hg
diff rust/hg-core/src/config/config.rs @ 46596:d2e61f00ee9d
rust: Introduce a get_bytes_from_os_str utility function
It does the same as get_bytes_from_path but takes an `OsStr`
instead of a `Path`. The implementation is the same so using either
ends up correct but the function name suggests it’s not.
Differential Revision: https://phab.mercurial-scm.org/D10007
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 17 Feb 2021 11:21:34 +0100 |
parents | 2e5dd18d6dc3 |
children | 305d74c262de |
line wrap: on
line diff
--- a/rust/hg-core/src/config/config.rs Wed Feb 17 12:24:53 2021 +0100 +++ b/rust/hg-core/src/config/config.rs Wed Feb 17 11:21:34 2021 +0100 @@ -11,7 +11,7 @@ use crate::config::layer::{ ConfigError, ConfigLayer, ConfigParseError, ConfigValue, }; -use crate::utils::files::get_bytes_from_path; +use crate::utils::files::get_bytes_from_os_str; use format_bytes::{write_bytes, DisplayBytes}; use std::env; use std::path::{Path, PathBuf}; @@ -134,8 +134,7 @@ layer.add( section.to_owned(), key.to_owned(), - // `value` is not a path but this works for any `OsStr`: - get_bytes_from_path(value), + get_bytes_from_os_str(value), None, ); self.layers.push(layer)