Unified · Split
| @@ -1,7 +1,6 @@ | ||
| 1 | +use std::convert::TryFrom; | |
| 1 | 2 | use std::{borrow::Cow, path::PathBuf}; |
| 2 | 3 | |
| 3 | −use bstr::BString; | |
| 4 | − | |
| 5 | 4 | use crate::{ |
| 6 | 5 | file::{from_paths, init::resolve_includes}, |
| 7 | 6 | parse::section, |
| @@ -27,6 +26,8 @@ pub enum Error { · 19 unmodified lines | ||
| 27 | 26 | FromPathsError(#[from] from_paths::Error), |
| 28 | 27 | #[error(transparent)] |
| 29 | 28 | Section(#[from] section::header::Error), |
| 29 | + #[error(transparent)] | |
| 30 | + Key(#[from] section::key::Error), | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | /// Instantiation from environment variables |
| @@ -112,8 +113,8 @@ impl File<'static> { · 79 unmodified lines | ||
| 112 | 113 | }; |
| 113 | 114 | |
| 114 | 115 | section.push( |
| 115 | − section::Key(BString::from(key).into()), | |
| 116 | − git_path::into_bstr(PathBuf::from(value)).as_ref(), | |
| 116 | + section::Key::try_from(key.to_owned())?, | |
| 117 | + git_path::os_str_into_bstr(&value).expect("no illformed UTF-8").as_ref(), | |
| 117 | 118 | ); |
| 118 | 119 | } |
| 119 | 120 | None => { |