Use assert_crate_local for a more explicit error
`assert_crate_local` does the same as the previous `if let` but with a more explicit error message if it's not a `ClearCrossCrate::Set`.
This commit is contained in:
parent
6669c2c6ce
commit
474e9a131d
@ -209,11 +209,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
|
|||||||
if !used_later {
|
if !used_later {
|
||||||
let span = terminator.source_info.span;
|
let span = terminator.source_info.span;
|
||||||
let scope = terminator.source_info.scope;
|
let scope = terminator.source_info.scope;
|
||||||
let node = if let mir::ClearCrossCrate::Set(scope_local_data) = &mir.source_scopes[scope].local_data {
|
let node = mir.source_scopes[scope]
|
||||||
scope_local_data.lint_root
|
.local_data
|
||||||
} else {
|
.as_ref()
|
||||||
unreachable!()
|
.assert_crate_local()
|
||||||
};
|
.lint_root;
|
||||||
|
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let Some(snip) = snippet_opt(cx, span);
|
if let Some(snip) = snippet_opt(cx, span);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user