We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 814a560 commit 8a2e67eCopy full SHA for 8a2e67e
library/std/src/sys/unix/os.rs
@@ -155,12 +155,10 @@ pub fn getcwd() -> io::Result<PathBuf> {
155
pub fn chdir(p: &path::Path) -> io::Result<()> {
156
let p: &OsStr = p.as_ref();
157
let p = CString::new(p.as_bytes())?;
158
- unsafe {
159
- match libc::chdir(p.as_ptr()) == (0 as c_int) {
160
- true => Ok(()),
161
- false => Err(io::Error::last_os_error()),
162
- }
+ if unsafe { libc::chdir(p.as_ptr()) } != 0 {
+ return Err(io::Error::last_os_error());
163
}
+ Ok(())
164
165
166
pub struct SplitPaths<'a> {
0 commit comments