Skip to content

Commit

Permalink
redundant_pattern_matching fix inverted boolean when missing Drop
Browse files Browse the repository at this point in the history
… trait # Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Fri Apr 2 19:04:45 2021 -0400
#
# On branch redundant_pattern_matching
# Your branch is ahead of 'origin/redundant_pattern_matching' by 1 commit.
# (use "git push" to publish your local commits)
#
# Changes to be committed:
#	modified: clippy_lints/src/matches.rs
# # Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Fri Apr 2 19:04:45 2021 -0400
#
# interactive rebase in progress; onto ebc6469
# Last commands done (6 commands done):
#    pick 25d211a Code cleanup and additional std types checked
#    r 0c71ce5 `redundant_pattern_matching` fix inverted boolean when missing `Drop` trait
# No commands remaining.
# You are currently editing a commit while rebasing branch 'redundant_pattern_matching' on 'ebc64690d'.
#
# Changes to be committed:
#	modified:   clippy_lints/src/matches.rs
#
  • Loading branch information
Jarcho committed Apr 3, 2021
1 parent f3d8bfb commit 3634c91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1737,11 +1737,11 @@ mod redundant_pattern_match {
fn type_needs_ordered_drop(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
if !ty.needs_drop(cx.tcx, cx.param_env) {
false
} else if cx
} else if !cx
.tcx
.lang_items()
.drop_trait()
.map_or(false, |id| !implements_trait(cx, ty, id, &[]))
.map_or(false, |id| implements_trait(cx, ty, id, &[]))
{
// This type doesn't implement drop, so no side effects here.
// Check if any component type has any.
Expand Down

0 comments on commit 3634c91

Please sign in to comment.