Skip to content

Commit

Permalink
Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk
Browse files Browse the repository at this point in the history
rustc: Use `tcx.used_crates(())` more

And explain when it should be used.

Addresses comments from rust-lang/rust#121167.
  • Loading branch information
matthiaskrgr authored May 23, 2024
2 parents f41b5c9 + a2d9f34 commit 266583a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ fn item_children_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) -> Vec<Re
/// This function is expensive and should be used sparingly.
pub fn def_path_res(cx: &LateContext<'_>, path: &[&str]) -> Vec<Res> {
fn find_crates(tcx: TyCtxt<'_>, name: Symbol) -> impl Iterator<Item = DefId> + '_ {
tcx.crates(())
tcx.crates_including_speculative(())
.iter()
.copied()
.filter(move |&num| tcx.crate_name(num) == name)
Expand Down

0 comments on commit 266583a

Please sign in to comment.