Return type of `io::Error::into_inner`

io::Error::into_inner returns an Option<Box<dyn Error + ..>> right now, but it should presumably return Result<Box<dyn Error + ..>,Self> like other consuming methods. Am I missing something here?

The only other data which an io error can have is the kind, so if you wanted a lossless destructure you can do (err.kind(), err.into_inner()). There no owned data attached to the error if into_inner returns None, and I expect that's why it was stabilized as returning Option.

It might've been more "correct" to return a result, but this is the signature that we've got.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.