From 6fdd54df7897cc226db35caeecd4b984aaa520ea Mon Sep 17 00:00:00 2001 From: Solra Bizna Date: Thu, 7 May 2020 18:31:30 -0600 Subject: [PATCH] Revert use of `map_or`, restoring compatibility with pre-1.41 rustc --- src/fcntl.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fcntl.rs b/src/fcntl.rs index e779458a50..5bdc9dda90 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -215,7 +215,8 @@ fn inner_readlink(dirfd: Option, path: &P) } // Uh oh, the result is too long... // Let's try to ask lstat how many bytes to allocate. - let reported_size = super::sys::stat::lstat(path).map_or(0, |x| x.st_size); + let reported_size = super::sys::stat::lstat(path) + .and_then(|x| Ok(x.st_size)).unwrap_or(0); let mut try_size = if reported_size > 0 { // Note: even if `lstat`'s apparently valid answer turns out to be // wrong, we will still read the full symlink no matter what.