Skip to content

Commit d150498

Browse files
Rollup merge of rust-lang#132698 - GuillaumeGomez:rm-unneeded-fields, r=notriddle
Remove unneeded fields in `scrape_examples::FindCalls` Just a small cleanup while going through something bigger. r? `@notriddle`
2 parents d6a43d4 + 03a63fd commit d150498

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/librustdoc/scrape_examples.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_hir::intravisit::{self, Visitor};
99
use rustc_hir::{self as hir};
1010
use rustc_interface::interface;
1111
use rustc_macros::{Decodable, Encodable};
12-
use rustc_middle::hir::map::Map;
1312
use rustc_middle::hir::nested_filter;
1413
use rustc_middle::ty::{self, TyCtxt};
1514
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
@@ -107,8 +106,6 @@ pub(crate) type AllCallLocations = FxIndexMap<DefPathHash, FnCallLocations>;
107106

108107
/// Visitor for traversing a crate and finding instances of function calls.
109108
struct FindCalls<'a, 'tcx> {
110-
tcx: TyCtxt<'tcx>,
111-
map: Map<'tcx>,
112109
cx: Context<'tcx>,
113110
target_crates: Vec<CrateNum>,
114111
calls: &'a mut AllCallLocations,
@@ -122,13 +119,13 @@ where
122119
type NestedFilter = nested_filter::OnlyBodies;
123120

124121
fn nested_visit_map(&mut self) -> Self::Map {
125-
self.map
122+
self.cx.tcx().hir()
126123
}
127124

128125
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
129126
intravisit::walk_expr(self, ex);
130127

131-
let tcx = self.tcx;
128+
let tcx = self.cx.tcx();
132129

133130
// If we visit an item that contains an expression outside a function body,
134131
// then we need to exit before calling typeck (which will panic). See
@@ -294,8 +291,7 @@ pub(crate) fn run(
294291

295292
// Run call-finder on all items
296293
let mut calls = FxIndexMap::default();
297-
let mut finder =
298-
FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates, bin_crate };
294+
let mut finder = FindCalls { calls: &mut calls, cx, target_crates, bin_crate };
299295
tcx.hir().visit_all_item_likes_in_crate(&mut finder);
300296

301297
// The visitor might have found a type error, which we need to

0 commit comments

Comments
 (0)