tools: use ? instead of try

merge-requests/7/merge
Alexandre Janniaux 2019-11-15 13:17:32 +01:00
parent 5b242e55a3
commit bde5163367
1 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ pub unsafe fn from_cstr_ref<'a>(p: *const c_char) -> Option<Cow<'a, str>> {
// Create CString from &Path // Create CString from &Path
pub fn path_to_cstr(path: &Path) -> Result<CString, NulError> { pub fn path_to_cstr(path: &Path) -> Result<CString, NulError> {
let path = try!(CString::new(path.to_string_lossy().into_owned())); let path = CString::new(path.to_string_lossy().into_owned())?;
Ok(path) Ok(path)
} }