File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ declare_clippy_lint! {
2727 #[ clippy:: version = "1.62.0" ]
2828 pub ARC_NEW_IN_VEC_FROM_SLICE ,
2929 suspicious,
30- "default lint description "
30+ "calling `Arc::new` in `vec![elem; len]` "
3131}
3232declare_lint_pass ! ( ArcNewInVecFromSlice => [ ARC_NEW_IN_VEC_FROM_SLICE ] ) ;
3333
@@ -69,11 +69,12 @@ fn first_arg_is_arc_new(args: &[Expr<'_>]) -> bool {
6969 if let ExprKind :: Path ( ref func_path) = func. kind;
7070 if let ExprKind :: Path ( QPath :: TypeRelative ( ty, _) ) = func. kind;
7171 if let TyKind :: Path ( ref ty_path) = ty. kind;
72- let func_segment = last_path_segment( func_path) ;
73- let ty_segment = last_path_segment( ty_path) ;
7472
7573 then {
76- return ty_segment. ident. name. as_str( ) == "Arc" && func_segment. ident. name. as_str( ) == "new" ;
74+ let func_segment = last_path_segment( func_path) ;
75+ let ty_segment = last_path_segment( ty_path) ;
76+
77+ return ty_segment. ident. name == sym:: Arc && func_segment. ident. name == sym:: new;
7778 }
7879 }
7980
You can’t perform that action at this time.
0 commit comments