diff --git a/native/src/base/cstr.rs b/native/src/base/cstr.rs index ab9f9ab31..53d0504b8 100644 --- a/native/src/base/cstr.rs +++ b/native/src/base/cstr.rs @@ -385,12 +385,12 @@ pub struct FsPath(Utf8CStr); impl FsPath { #[inline(always)] - pub fn from<'a, T: AsRef>(value: T) -> &'a FsPath { + pub fn from + ?Sized>(value: &T) -> &FsPath { unsafe { mem::transmute(value.as_ref()) } } #[inline(always)] - pub fn from_mut<'a, T: AsMut>(mut value: T) -> &'a mut FsPath { + pub fn from_mut + ?Sized>(value: &mut T) -> &mut FsPath { unsafe { mem::transmute(value.as_mut()) } } } diff --git a/native/src/base/files.rs b/native/src/base/files.rs index 253113e83..424bdaa04 100644 --- a/native/src/base/files.rs +++ b/native/src/base/files.rs @@ -229,13 +229,13 @@ impl DirEntry<'_> { pub fn get_attr(&self) -> io::Result { let mut path = Utf8CStrBufArr::default(); self.path(&mut path)?; - FsPath::from(path).get_attr() + FsPath::from(&path).get_attr() } pub fn set_attr(&self, attr: &FileAttr) -> io::Result<()> { let mut path = Utf8CStrBufArr::default(); self.path(&mut path)?; - FsPath::from(path).set_attr(attr) + FsPath::from(&path).set_attr(attr) } }