minor code cleanups
This commit is contained in:
@@ -578,10 +578,9 @@ pub unsafe extern "C" fn fopen(filename: *const c_char, mode: *const c_char) ->
|
||||
|
||||
helpers::_fdopen(fd, unsafe { CStr::from_ptr(mode) })
|
||||
.map(Box::into_raw)
|
||||
.map_err(|err| {
|
||||
.inspect_err(|err| {
|
||||
// TODO: guard type
|
||||
if let Ok(()) = Sys::close(fd) {}; // TODO handle error
|
||||
err
|
||||
})
|
||||
.or_errno_null_mut()
|
||||
}
|
||||
|
||||
@@ -610,9 +610,8 @@ impl<'a, T: c_str::Kind> Iterator for PrintfIter<'a, T> {
|
||||
self.format = first_percent.split_first().expect("must be %").1;
|
||||
|
||||
let mut peekahead = self.format;
|
||||
let index = pop_index(&mut peekahead).map(|i| {
|
||||
let index = pop_index(&mut peekahead).inspect(|i| {
|
||||
self.format = peekahead;
|
||||
i
|
||||
});
|
||||
|
||||
// Flags:
|
||||
|
||||
Reference in New Issue
Block a user