Skip to content

Commit 24d0f03

Browse files
committed
Use is_copy
1 parent 992894d commit 24d0f03

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/matches/manual_map.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ use super::MANUAL_MAP;
22
use crate::{map_unit_fn::OPTION_MAP_UNIT_FN, matches::MATCH_AS_REF};
33
use clippy_utils::diagnostics::span_lint_and_sugg;
44
use clippy_utils::source::{snippet_with_applicability, snippet_with_context};
5-
use clippy_utils::ty::{
6-
implements_trait, is_type_diagnostic_item, peel_mid_ty_refs_is_mutable, type_is_unsafe_function,
7-
};
5+
use clippy_utils::ty::{is_copy, is_type_diagnostic_item, peel_mid_ty_refs_is_mutable, type_is_unsafe_function};
86
use clippy_utils::{
97
can_move_expr_to_closure, is_else_clause, is_lang_ctor, is_lint_allowed, path_to_local_id, peel_blocks,
108
peel_hir_expr_refs, peel_hir_expr_while, sugg::Sugg, CaptureKind,
@@ -240,11 +238,7 @@ where
240238
};
241239

242240
// relies on the fact that Option<T>: Copy where T: copy
243-
let scrutinee_impl_copy = cx
244-
.tcx
245-
.lang_items()
246-
.copy_trait()
247-
.map_or(false, |id| implements_trait(cx, scrutinee_ty, id, &[]));
241+
let scrutinee_impl_copy = is_copy(cx, scrutinee_ty);
248242

249243
Some(SuggInfo {
250244
needs_brackets: else_pat.is_none() && is_else_clause(cx.tcx, expr),

0 commit comments

Comments
 (0)