Skip to content

Commit fb3b77a

Browse files
committed
Add fake_read() to clippy
1 parent 74fc643 commit fb3b77a

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/tools/clippy/clippy_lints/src/escape.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use rustc_hir::intravisit;
22
use rustc_hir::{self, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node};
33
use rustc_infer::infer::TyCtxtInferExt;
44
use rustc_lint::{LateContext, LateLintPass};
5+
use rustc_middle::mir::FakeReadCause;
56
use rustc_middle::ty::{self, TraitRef, Ty};
67
use rustc_session::{declare_tool_lint, impl_lint_pass};
78
use rustc_span::source_map::Span;
@@ -184,6 +185,8 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
184185
}
185186
}
186187
}
188+
189+
fn fake_read(&mut self, _: rustc_typeck::expr_use_visitor::Place<'tcx>, _: FakeReadCause) { }
187190
}
188191

189192
impl<'a, 'tcx> EscapeDelegate<'a, 'tcx> {

src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rustc_hir::intravisit::FnKind;
1111
use rustc_hir::{BindingAnnotation, Body, FnDecl, GenericArg, HirId, Impl, ItemKind, Node, PatKind, QPath, TyKind};
1212
use rustc_infer::infer::TyCtxtInferExt;
1313
use rustc_lint::{LateContext, LateLintPass};
14+
use rustc_middle::mir::FakeReadCause;
1415
use rustc_middle::ty::{self, TypeFoldable};
1516
use rustc_session::{declare_lint_pass, declare_tool_lint};
1617
use rustc_span::symbol::kw;
@@ -333,4 +334,6 @@ impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt {
333334
fn borrow(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {}
334335

335336
fn mutate(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId) {}
337+
338+
fn fake_read(&mut self, _: rustc_typeck::expr_use_visitor::Place<'tcx>, _: FakeReadCause) { }
336339
}

src/tools/clippy/clippy_utils/src/usage.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_hir::intravisit::{NestedVisitorMap, Visitor};
77
use rustc_hir::{Expr, ExprKind, HirId, Path};
88
use rustc_infer::infer::TyCtxtInferExt;
99
use rustc_lint::LateContext;
10+
use rustc_middle::mir::FakeReadCause;
1011
use rustc_middle::hir::map::Map;
1112
use rustc_middle::ty;
1213
use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
@@ -77,6 +78,8 @@ impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
7778
fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
7879
self.update(&cmt)
7980
}
81+
82+
fn fake_read(&mut self, _: rustc_typeck::expr_use_visitor::Place<'tcx>, _: FakeReadCause) { }
8083
}
8184

8285
pub struct ParamBindingIdCollector {

0 commit comments

Comments
 (0)