Add ErrSpan extension trait for Result (#12626)

# Description
This adds an extension trait to `Result` that wraps errors in `Spanned`,
saving the effort of calling `.map_err(|err| err.into_spanned(span))`
every time. This will hopefully make it even more likely that someone
will want to use a spanned `io::Error` and make it easier to remove the
impl for `From<io::Error> for ShellError` because that doesn't have span
information.
This commit is contained in:
Devyn Cairns
2024-04-23 01:39:55 -07:00
committed by GitHub
parent b0acc1d890
commit 5c7f7883c8
10 changed files with 47 additions and 21 deletions

View File

@@ -133,7 +133,7 @@ impl Command for Save {
.spawn(move || stderr.drain()),
})
.transpose()
.map_err(|e| e.into_spanned(span))?;
.err_span(span)?;
let res = stream_to_file(stdout, file, span, progress);
if let Some(h) = handler {