Skip to content

Commit

Permalink
Use assert_crate_local for a more explicit error
Browse files Browse the repository at this point in the history
`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`.
  • Loading branch information
phansch committed Dec 2, 2019
1 parent 6669c2c commit 5228fb8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
if !used_later {
let span = terminator.source_info.span;
let scope = terminator.source_info.scope;
let node = if let mir::ClearCrossCrate::Set(scope_local_data) = &mir.source_scopes[scope].local_data {
scope_local_data.lint_root
} else {
unreachable!()
};
let node = mir.source_scopes[scope].local_data.as_ref().assert_crate_local().lint_root;

if_chain! {
if let Some(snip) = snippet_opt(cx, span);
Expand Down

0 comments on commit 5228fb8

Please sign in to comment.