-struct UsedVisitor<'a, 'tcx> {
- cx: &'a LateContext<'a, 'tcx>,
- id: hir::HirId,
- used: bool,
-}
-
-impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UsedVisitor<'a, 'tcx> {
- fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
- if_chain! {
- if let hir::ExprKind::Path(ref qpath) = expr.kind;
- if let Res::Local(local_id) = qpath_res(self.cx, qpath, expr.hir_id);
- if self.id == local_id;
- then {
- self.used = true;
- return;
- }
- }
- hir::intravisit::walk_expr(self, expr);
- }
- fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> {
- hir::intravisit::NestedVisitorMap::None
- }
-}
-
-fn check_assign<'a, 'tcx>(
- cx: &LateContext<'a, 'tcx>,