From 1e008bec49a0f97aeaaea6130a0ba20fe00aa03b Mon Sep 17 00:00:00 2001 From: Yury Date: Thu, 7 Nov 2024 05:58:15 +0300 Subject: [PATCH] Cleanup cf::Url a little bit --- cidre/src/cf/url.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/cidre/src/cf/url.rs b/cidre/src/cf/url.rs index 05be6e4c..310243a4 100644 --- a/cidre/src/cf/url.rs +++ b/cidre/src/cf/url.rs @@ -61,17 +61,7 @@ impl Url { #[inline] pub fn with_path(path: &Path, is_dir: bool) -> Option> { - let bytes = path.to_str()?.as_bytes(); - let encoding = cf::StringEncoding::UTF8; - let Some(path) = cf::String::create_with_bytes_no_copy_in( - bytes, - encoding, - false, - cf::Allocator::null(), - None, - ) else { - return None; - }; + let path = unsafe { cf::String::from_str_no_copy(path.to_str()?) }; cf::Url::with_fs_path_in(&path, PathStyle::Posix, is_dir, None) }