Skip to content

Commit dafdad7

Browse files
committed
get path_ty in a cleaner way
1 parent 3550676 commit dafdad7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clippy_lints/src/needless_path_new.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ fn check_arguments<'tcx>(
7575
}
7676
};
7777

78-
let Some(path_def_id) = tcx.get_diagnostic_item(sym::Path) else {
79-
return;
78+
let path_ty = {
79+
let Some(path_def_id) = tcx.get_diagnostic_item(sym::Path) else {
80+
return;
81+
};
82+
Ty::new_adt(tcx, tcx.adt_def(path_def_id), List::empty())
8083
};
81-
let path_ty = Ty::new_adt(tcx, tcx.adt_def(path_def_id), List::empty());
84+
8285
let Some(asref_def_id) = tcx.get_diagnostic_item(sym::AsRef) else {
8386
return;
8487
};

0 commit comments

Comments
 (0)