Skip to content

Commit 3b60133

Browse files
committed
Nit
1 parent 23281b8 commit 3b60133

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

stdlib/src/mmap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ mod mmap {
338338
}
339339
};
340340

341-
let fd = unsafe { crt_fd::Borrowed::try_borrow_raw(fd) }.ok();
342-
if let Some(fd) = fd {
341+
let fd = unsafe { crt_fd::Borrowed::try_borrow_raw(fd) };
342+
if let Ok(fd) = fd {
343343
let metadata = fstat(fd)
344344
.map_err(|err| io::Error::from_raw_os_error(err as i32).to_pyexception(vm))?;
345345
let file_len = metadata.st_size;
@@ -365,7 +365,7 @@ mod mmap {
365365
let mmap_opt = mmap_opt.offset(offset.try_into().unwrap()).len(map_size);
366366

367367
let (fd, mmap) = || -> std::io::Result<_> {
368-
if let Some(fd) = fd {
368+
if let Ok(fd) = fd {
369369
let new_fd: crt_fd::Owned = unistd::dup(fd)?.into();
370370
let mmap = match access {
371371
AccessMode::Default | AccessMode::Write => {

stdlib/src/posixsubprocess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl TryFromObject for Fd {
127127
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
128128
match MaybeFd::try_from_object(vm, obj)? {
129129
MaybeFd::Valid(fd) => Ok(fd),
130-
MaybeFd::Invalid => Err(vm.new_value_error("invalid fd".to_owned())),
130+
MaybeFd::Invalid => Err(vm.new_value_error("invalid fd")),
131131
}
132132
}
133133
}

0 commit comments

Comments
 (0)