Walk back to the root context to compute the span (#14349)
Since the error kind (`io::ErrorKind::other`) is in the root context, the error message must be found in the root context as well to compute the correct span to remove. Fix #14346 changelog: [`io_error_other`]: fix non-applicable suggestion r? @llogiq
This commit is contained in:
commit
9538e5bcd0
4 changed files with 24 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, path: &Expr<'_>, args
|
|||
"use `std::io::Error::other`",
|
||||
vec![
|
||||
(new_segment.ident.span, "other".to_owned()),
|
||||
(error_kind.span.until(error.span), String::new()),
|
||||
(error_kind.span.until(error.span.source_callsite()), String::new()),
|
||||
],
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue