Skip to content

Commit 0cfdb8a

Browse files
committed
fix pr comments
1 parent 62f7694 commit 0cfdb8a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

clippy_lints/src/arc_new_in_vec_from_elem.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ declare_clippy_lint! {
3030
suspicious,
3131
"calling `Arc::new` in `vec![elem; len]`"
3232
}
33-
declare_lint_pass!(ArcNewInVecFromSlice => [ARC_NEW_IN_VEC_FROM_ELEM]);
33+
declare_lint_pass!(ArcNewInVecFromElem => [ARC_NEW_IN_VEC_FROM_ELEM]);
3434

35-
impl LateLintPass<'_> for ArcNewInVecFromSlice {
35+
impl LateLintPass<'_> for ArcNewInVecFromElem {
3636
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
3737
let Some(macro_call) = root_macro_call_first_node(cx, expr) else { return; };
3838

@@ -67,10 +67,9 @@ fn is_arc_new(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
6767
if cx.tcx.is_diagnostic_item(sym::Arc, def_id);
6868

6969
then {
70-
let ty_segment = last_path_segment(ty_path);
7170
let func_segment = last_path_segment(func_path);
7271

73-
return ty_segment.ident.name == sym::Arc && func_segment.ident.name == sym::new;
72+
return func_segment.ident.name == sym::new;
7473
}
7574
}
7675

clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
888888
store.register_late_pass(|| Box::new(bytes_count_to_len::BytesCountToLen));
889889
let max_include_file_size = conf.max_include_file_size;
890890
store.register_late_pass(move || Box::new(large_include_file::LargeIncludeFile::new(max_include_file_size)));
891-
store.register_late_pass(|| Box::new(arc_new_in_vec_from_elem::ArcNewInVecFromSlice));
891+
store.register_late_pass(|| Box::new(arc_new_in_vec_from_elem::ArcNewInVecFromElem));
892892
// add lints here, do not remove this comment, it's used in `new_lint`
893893
}
894894

0 commit comments

Comments
 (0)