@@ -3,7 +3,7 @@ use clippy_utils::diagnostics::span_lint_and_then;
33use clippy_utils:: higher:: VecArgs ;
44use clippy_utils:: macros:: matching_root_macro_call;
55use clippy_utils:: source:: snippet;
6- use clippy_utils:: { expr_or_init, fn_def_id, match_def_path , paths } ;
6+ use clippy_utils:: { expr_or_init, fn_def_id} ;
77use rustc_errors:: Applicability ;
88use rustc_hir:: { Expr , ExprKind } ;
99use rustc_lint:: { LateContext , LateLintPass } ;
@@ -67,7 +67,7 @@ fn emit_lint(cx: &LateContext<'_>, span: Span, kind: &str, note: &'static str, s
6767fn check_vec_macro ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
6868 if matching_root_macro_call ( cx, expr. span , sym:: vec_macro) . is_some ( )
6969 && let Some ( VecArgs :: Repeat ( repeat_expr, len_expr) ) = VecArgs :: hir ( cx, expr)
70- && fn_def_id ( cx, repeat_expr) . is_some_and ( |did| match_def_path ( cx , did, & paths :: VEC_WITH_CAPACITY ) )
70+ && fn_def_id ( cx, repeat_expr) . is_some_and ( |did| cx . tcx . is_diagnostic_item ( sym :: vec_with_capacity , did) )
7171 && !len_expr. span . from_expansion ( )
7272 && let Some ( Constant :: Int ( 2 ..) ) = ConstEvalCtxt :: new ( cx) . eval ( expr_or_init ( cx, len_expr) )
7373 {
@@ -91,7 +91,7 @@ fn check_repeat_fn(cx: &LateContext<'_>, expr: &Expr<'_>) {
9191 if !expr. span . from_expansion ( )
9292 && fn_def_id ( cx, expr) . is_some_and ( |did| cx. tcx . is_diagnostic_item ( sym:: iter_repeat, did) )
9393 && let ExprKind :: Call ( _, [ repeat_expr] ) = expr. kind
94- && fn_def_id ( cx, repeat_expr) . is_some_and ( |did| match_def_path ( cx , did, & paths :: VEC_WITH_CAPACITY ) )
94+ && fn_def_id ( cx, repeat_expr) . is_some_and ( |did| cx . tcx . is_diagnostic_item ( sym :: vec_with_capacity , did) )
9595 && !repeat_expr. span . from_expansion ( )
9696 {
9797 emit_lint (
0 commit comments