Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Feb 24, 2020
1 parent f85b0c4 commit a211a82
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,17 +533,17 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
match self.tables.expr_ty_adjusted(&hir_node).kind {
ty::Adt(def, _) if !def.is_enum() => {
let variant = &def.non_enum_variant();
if let Some(index) = self.tcx.find_field_index(ident, variant) {
filter!(self.span_utils, ident.span);
let span = self.span_from_span(ident.span);
return Some(Data::RefData(Ref {
kind: RefKind::Variable,
span,
ref_id: id_from_def_id(variant.fields[index].did),
}));
}

None
filter!(self.span_utils, ident.span);
let span = self.span_from_span(ident.span);
return Some(Data::RefData(Ref {
kind: RefKind::Variable,
span,
ref_id: self
.tcx
.find_field_index(ident, variant)
.map(|index| id_from_def_id(variant.fields[index].did))
.unwrap_or_else(|| null_id()),
}));
}
ty::Tuple(..) => None,
_ => {
Expand Down

0 comments on commit a211a82

Please sign in to comment.