privacy: Avoid some unnecessary mutability
This commit is contained in:
parent
f5e2df741b
commit
156499e561
1 changed files with 5 additions and 5 deletions
|
|
@ -929,7 +929,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
|
|||
|
||||
// Checks that a field in a struct constructor (expression or pattern) is accessible.
|
||||
fn check_field(
|
||||
&mut self,
|
||||
&self,
|
||||
hir_id: hir::HirId, // ID of the field use
|
||||
use_ctxt: Span, // syntax context of the field name at the use site
|
||||
def: ty::AdtDef<'tcx>, // definition of the struct or enum
|
||||
|
|
@ -947,7 +947,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
|
|||
|
||||
// Checks that a field in a struct constructor (expression or pattern) is accessible.
|
||||
fn emit_unreachable_field_error(
|
||||
&mut self,
|
||||
&self,
|
||||
fields: Vec<(Symbol, Span, bool /* field is present */)>,
|
||||
def: ty::AdtDef<'tcx>, // definition of the struct or enum
|
||||
update_syntax: Option<Span>,
|
||||
|
|
@ -1010,7 +1010,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
|
|||
}
|
||||
|
||||
fn check_expanded_fields(
|
||||
&mut self,
|
||||
&self,
|
||||
adt: ty::AdtDef<'tcx>,
|
||||
variant: &'tcx ty::VariantDef,
|
||||
fields: &[hir::ExprField<'tcx>],
|
||||
|
|
@ -1148,7 +1148,7 @@ impl<'tcx> TypePrivacyVisitor<'tcx> {
|
|||
result.is_break()
|
||||
}
|
||||
|
||||
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
|
||||
fn check_def_id(&self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
|
||||
let is_error = !self.item_is_accessible(def_id);
|
||||
if is_error {
|
||||
self.tcx.dcx().emit_err(ItemIsPrivate { span: self.span, kind, descr: descr.into() });
|
||||
|
|
@ -1405,7 +1405,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
|
|||
self
|
||||
}
|
||||
|
||||
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
|
||||
fn check_def_id(&self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
|
||||
if self.leaks_private_dep(def_id) {
|
||||
self.tcx.emit_node_span_lint(
|
||||
lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue