fn eval_libc(&mut self, name: &str) -> InterpResult<'tcx, Scalar<Tag>> {
self.eval_context_mut()
.eval_path_scalar(&["libc", name])?
- .ok_or_else(|| err_unsup_format!("Path libc::{} cannot be resolved.", name).into())
- .and_then(|scalar| scalar.not_undef())
+ .ok_or_else(|| err_unsup_format!("Path libc::{} cannot be resolved.", name))?
+ .not_undef()
}
/// Helper function to get a `libc` constant as an `i32`.
fn eval_libc_i32(&mut self, name: &str) -> InterpResult<'tcx, i32> {
- self.eval_libc(name).and_then(|scalar| scalar.to_i32())
+ self.eval_libc(name)?.to_i32()
}
}
let mut bytes = cwd.display().to_string().into_bytes();
// If `size` is smaller or equal than the `bytes.len()`, writing `bytes` plus the
// required null terminator to memory using the `buf` pointer would cause an
- // overflow, the desired behavior in this case is to return null.
+ // overflow. The desired behavior in this case is to return null.
if (bytes.len() as u64) < size {
// We add a `/0` terminator
bytes.push(0);