Skip to content

Commit

Permalink
Move def_id logic into render_call_locations
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Oct 22, 2021
1 parent d1c29c6 commit fd5d614
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,7 @@ fn document_full_inner(
};

if let clean::ItemKind::FunctionItem(..) | clean::ItemKind::MethodItem(..) = kind {
if let Some(def_id) = item.def_id.as_def_id() {
render_call_locations(w, cx, def_id, item);
}
render_call_locations(w, cx, item);
}
}

Expand Down Expand Up @@ -2463,8 +2461,9 @@ const MAX_FULL_EXAMPLES: usize = 5;
const NUM_VISIBLE_LINES: usize = 10;

/// Generates the HTML for example call locations generated via the --scrape-examples flag.
fn render_call_locations(w: &mut Buffer, cx: &Context<'_>, def_id: DefId, item: &clean::Item) {
fn render_call_locations(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item) {
let tcx = cx.tcx();
let def_id = item.def_id.expect_def_id();
let key = tcx.def_path_hash(def_id);
let call_locations = match cx.shared.call_locations.get(&key) {
Some(call_locations) => call_locations,
Expand Down

0 comments on commit fd5d614

Please sign in to comment.