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 474e9a1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ 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 474e9a1

Please sign in to comment.