Skip to content

Commit 5228fb8

Browse files
committed
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`.
1 parent 6669c2c commit 5228fb8

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

clippy_lints/src/redundant_clone.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
209209
if !used_later {
210210
let span = terminator.source_info.span;
211211
let scope = terminator.source_info.scope;
212-
let node = if let mir::ClearCrossCrate::Set(scope_local_data) = &mir.source_scopes[scope].local_data {
213-
scope_local_data.lint_root
214-
} else {
215-
unreachable!()
216-
};
212+
let node = mir.source_scopes[scope].local_data.as_ref().assert_crate_local().lint_root;
217213

218214
if_chain! {
219215
if let Some(snip) = snippet_opt(cx, span);

0 commit comments

Comments
 (0)