Skip to content

Commit 156499e

Browse files
committed
privacy: Avoid some unnecessary mutability
1 parent f5e2df7 commit 156499e

File tree

1 file changed

+5
-5
lines changed
  • compiler/rustc_privacy/src

1 file changed

+5
-5
lines changed

compiler/rustc_privacy/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
929929

930930
// Checks that a field in a struct constructor (expression or pattern) is accessible.
931931
fn check_field(
932-
&mut self,
932+
&self,
933933
hir_id: hir::HirId, // ID of the field use
934934
use_ctxt: Span, // syntax context of the field name at the use site
935935
def: ty::AdtDef<'tcx>, // definition of the struct or enum
@@ -947,7 +947,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
947947

948948
// Checks that a field in a struct constructor (expression or pattern) is accessible.
949949
fn emit_unreachable_field_error(
950-
&mut self,
950+
&self,
951951
fields: Vec<(Symbol, Span, bool /* field is present */)>,
952952
def: ty::AdtDef<'tcx>, // definition of the struct or enum
953953
update_syntax: Option<Span>,
@@ -1010,7 +1010,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
10101010
}
10111011

10121012
fn check_expanded_fields(
1013-
&mut self,
1013+
&self,
10141014
adt: ty::AdtDef<'tcx>,
10151015
variant: &'tcx ty::VariantDef,
10161016
fields: &[hir::ExprField<'tcx>],
@@ -1148,7 +1148,7 @@ impl<'tcx> TypePrivacyVisitor<'tcx> {
11481148
result.is_break()
11491149
}
11501150

1151-
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
1151+
fn check_def_id(&self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
11521152
let is_error = !self.item_is_accessible(def_id);
11531153
if is_error {
11541154
self.tcx.dcx().emit_err(ItemIsPrivate { span: self.span, kind, descr: descr.into() });
@@ -1405,7 +1405,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
14051405
self
14061406
}
14071407

1408-
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
1408+
fn check_def_id(&self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
14091409
if self.leaks_private_dep(def_id) {
14101410
self.tcx.emit_node_span_lint(
14111411
lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES,

0 commit comments

Comments
 (0)