Skip to content

Commit 1de9d10

Browse files
committed
Style fixes
1 parent 3aff803 commit 1de9d10

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/shims/fs.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
142142
} else if cmd == this.eval_libc_i32("F_DUPFD")? || cmd == this.eval_libc_i32("F_DUPFD_CLOEXEC")? {
143143
// Note that we always assume the FD_CLOEXEC flag is set for every open file, in part
144144
// because exec() isn't supported. The F_DUPFD and F_DUPFD_CLOEXEC commands only
145-
// differ in whether the FD_CLOEXEC flag is pre-set on the duplicated file descriptor,
145+
// differ in whether the FD_CLOEXEC flag is pre-set on the new file descriptor,
146146
// thus they can share the same implementation here.
147-
let arg = match arg_op {
148-
Some(arg_op) => this.read_scalar(arg_op)?.to_i32()?,
149-
None => throw_unsup_format!("fcntl with command F_DUPFD or F_DUPFD_CLOEXEC requires a third argument"),
150-
};
147+
let arg_op = arg_op
148+
.ok_or_else(|| err_unsup_format!("fcntl with command F_DUPFD or F_DUPFD_CLOEXEC requires a third argument"))?;
149+
let arg = this.read_scalar(arg_op)?.to_i32()?;
151150
let fh = &mut this.machine.file_handler;
152151
let (file_result, writable) = match fh.handles.get(&fd) {
153152
Some(original) => (original.file.try_clone(), original.writable),

0 commit comments

Comments
 (0)