Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {

if !used_later {
let span = terminator.source_info.span;
let node = if let mir::ClearCrossCrate::Set(scope_local_data) = &mir.source_scope_local_data {
scope_local_data[terminator.source_info.scope].lint_root
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!()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're going to panic, please use .as_ref().assert_crate_local() like I did in my PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks!

};
Expand Down