Skip to content

Commit ba50a09

Browse files
committed
simplify vexFileStatus check in fs::exists
1 parent b07ef19 commit ba50a09

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

library/std/src/sys/fs/vexos.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,7 @@ pub fn exists(path: &Path) -> io::Result<bool> {
512512
let path = CString::new(path.as_os_str().as_encoded_bytes())
513513
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Path contained a null byte"))?;
514514

515-
let file_exists = unsafe { vex_sdk::vexFileStatus(path.as_ptr()) };
516-
if file_exists != 0 { Ok(true) } else { Ok(false) }
515+
Ok(unsafe { vex_sdk::vexFileStatus(path.as_ptr()) } != 0)
517516
}
518517

519518
pub fn readlink(_p: &Path) -> io::Result<PathBuf> {

0 commit comments

Comments
 (0)