about summary refs log tree commit diff
path: root/compiler/rustc_privacy/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-04 17:59:21 +0000
committerMichael Goulet <michael@errs.io>2022-12-04 17:59:21 +0000
commit26b24cd7558c02c433ef9f621894cb6a2f31898d (patch)
tree7d68ed7058a17a65b8558f4a5625729425f91460 /compiler/rustc_privacy/src
parent19c250aa1231f1e1b0953829e999e4862961207d (diff)
downloadrust-26b24cd7558c02c433ef9f621894cb6a2f31898d.tar.gz
rust-26b24cd7558c02c433ef9f621894cb6a2f31898d.zip
drive-by: move field_index to typeck results
Diffstat (limited to 'compiler/rustc_privacy/src')
-rw-r--r--compiler/rustc_privacy/src/lib.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs
index f2177a7c283..a254c892478 100644
--- a/compiler/rustc_privacy/src/lib.rs
+++ b/compiler/rustc_privacy/src/lib.rs
@@ -1065,9 +1065,9 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
                 // are checked for privacy (RFC 736). Rather than computing the set of
                 // unmentioned fields, just check them all.
                 for (vf_index, variant_field) in variant.fields.iter().enumerate() {
-                    let field = fields.iter().find(|f| {
-                        self.tcx.field_index(f.hir_id, self.typeck_results()) == vf_index
-                    });
+                    let field = fields
+                        .iter()
+                        .find(|f| self.typeck_results().field_index(f.hir_id) == vf_index);
                     let (use_ctxt, span) = match field {
                         Some(field) => (field.ident.span, field.span),
                         None => (base.span, base.span),
@@ -1077,7 +1077,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
             } else {
                 for field in fields {
                     let use_ctxt = field.ident.span;
-                    let index = self.tcx.field_index(field.hir_id, self.typeck_results());
+                    let index = self.typeck_results().field_index(field.hir_id);
                     self.check_field(use_ctxt, field.span, adt, &variant.fields[index], false);
                 }
             }
@@ -1093,7 +1093,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
             let variant = adt.variant_of_res(res);
             for field in fields {
                 let use_ctxt = field.ident.span;
-                let index = self.tcx.field_index(field.hir_id, self.typeck_results());
+                let index = self.typeck_results().field_index(field.hir_id);
                 self.check_field(use_ctxt, field.span, adt, &variant.fields[index], false);
             }
         }