Skip to content

Commit 9988115

Browse files
committed
privacy: Avoid some unnecessary mutability
1 parent 910617d commit 9988115

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
@@ -923,7 +923,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
923923

924924
// Checks that a field in a struct constructor (expression or pattern) is accessible.
925925
fn check_field(
926-
&mut self,
926+
&self,
927927
hir_id: hir::HirId, // ID of the field use
928928
use_ctxt: Span, // syntax context of the field name at the use site
929929
def: ty::AdtDef<'tcx>, // definition of the struct or enum
@@ -941,7 +941,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
941941

942942
// Checks that a field in a struct constructor (expression or pattern) is accessible.
943943
fn emit_unreachable_field_error(
944-
&mut self,
944+
&self,
945945
fields: Vec<(Symbol, Span, bool /* field is present */)>,
946946
def: ty::AdtDef<'tcx>, // definition of the struct or enum
947947
update_syntax: Option<Span>,
@@ -1004,7 +1004,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
10041004
}
10051005

10061006
fn check_expanded_fields(
1007-
&mut self,
1007+
&self,
10081008
adt: ty::AdtDef<'tcx>,
10091009
variant: &'tcx ty::VariantDef,
10101010
fields: &[hir::ExprField<'tcx>],
@@ -1142,7 +1142,7 @@ impl<'tcx> TypePrivacyVisitor<'tcx> {
11421142
result.is_break()
11431143
}
11441144

1145-
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
1145+
fn check_def_id(&self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
11461146
let is_error = !self.item_is_accessible(def_id);
11471147
if is_error {
11481148
self.tcx.dcx().emit_err(ItemIsPrivate { span: self.span, kind, descr: descr.into() });
@@ -1401,7 +1401,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
14011401
self
14021402
}
14031403

1404-
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
1404+
fn check_def_id(&self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
14051405
if self.leaks_private_dep(def_id) {
14061406
self.tcx.emit_node_span_lint(
14071407
lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES,

0 commit comments

Comments
 (0)