Skip to content

Commit 003b257

Browse files
committed
Change error handling style for consistency
1 parent 60cf06a commit 003b257

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
296296
fn eval_libc(&mut self, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
297297
self.eval_context_mut()
298298
.eval_path_scalar(&["libc", name])?
299-
.ok_or_else(|| err_unsup_format!("Path libc::{} cannot be resolved.", name).into())
300-
.and_then(|scalar| scalar.not_undef())
299+
.ok_or_else(|| err_unsup_format!("Path libc::{} cannot be resolved.", name))?
300+
.not_undef()
301301
}
302302

303303
/// Helper function to get a `libc` constant as an `i32`.
304304
fn eval_libc_i32(&mut self, name: &str) -> InterpResult<'tcx, i32> {
305-
self.eval_libc(name).and_then(|scalar| scalar.to_i32())
305+
self.eval_libc(name)?.to_i32()
306306
}
307307
}

src/shims/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
135135
let mut bytes = cwd.display().to_string().into_bytes();
136136
// If `size` is smaller or equal than the `bytes.len()`, writing `bytes` plus the
137137
// required null terminator to memory using the `buf` pointer would cause an
138-
// overflow, the desired behavior in this case is to return null.
138+
// overflow. The desired behavior in this case is to return null.
139139
if (bytes.len() as u64) < size {
140140
// We add a `/0` terminator
141141
bytes.push(0);

0 commit comments

Comments
 (0)