Skip to content

Commit

Permalink
Make it compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed May 4, 2019
1 parent 20c07ce commit e43eddc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
}
let res = self.cx.tables.qpath_res(seqpath, seqexpr.hir_id);
match res {
Res::Local(hir_id) | Res::Def(Res::Upvar(..), hir_id, ..) => {
Res::Local(hir_id) | Res::Upvar(hir_id, ..) => {
let parent_id = self.cx.tcx.hir().get_parent_item(expr.hir_id);
let parent_def_id = self.cx.tcx.hir().local_def_id_from_hir_id(parent_id);
let extent = self.cx.tcx.region_scope_tree(parent_def_id).var_scope(hir_id.local_id);
Expand Down Expand Up @@ -1835,7 +1835,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
if path.segments.len() == 1;
then {
match self.cx.tables.qpath_res(qpath, expr.hir_id) {
Res::Def(Res::Upvar(..), local_id, ..) => {
Res::Upvar(local_id, ..) => {
if local_id == self.var {
// we are not indexing anything, record that
self.nonindex = true;
Expand Down Expand Up @@ -2383,7 +2383,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
let res = self.cx.tables.qpath_res(qpath, ex.hir_id);
then {
match res {
Res::Local(node_id) | Res::Def(Res::Upvar(..), node_id, ..) => {
Res::Local(node_id) | Res::Upvar(node_id, ..) => {
self.ids.insert(node_id);
},
Res::Def(DefKind::Static, def_id) => {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ fn in_attributes_expansion(expr: &Expr) -> bool {
/// Tests whether `res` is a variable defined outside a macro.
fn non_macro_local(cx: &LateContext<'_, '_>, res: def::Res) -> bool {
match res {
def::Res::Local(id) | def::Res(Res::Upvar(..), id, _, _) => !in_macro(cx.tcx.hir().span_by_hir_id(id)),
def::Res::Local(id) | def::Res::Upvar(id, ..) => !in_macro(cx.tcx.hir().span_by_hir_id(id)),
_ => false,
}
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/question_mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl QuestionMark {
},
ExprKind::Ret(Some(ref expr)) => Self::expression_returns_none(cx, expr),
ExprKind::Path(ref qp) => {
if let Res::Def(DefKind::Ctor(_, def::CtorOf::Variant), def_id) = cx.tables.qpath_res(qp, expression.hir_id) {
if let Res::Def(DefKind::Ctor(def::CtorOf::Variant, def::CtorKind::Const), def_id) = cx.tables.qpath_res(qp, expression.hir_id) {
return cx.match_def_path(def_id, &OPTION_NONE);
}

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
if path.segments.last().expect(SEGMENTS_MSG).ident.name != SelfUpper.name() {
if self.item_path.res == path.res {
span_use_self_lint(self.cx, path);
} else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, ctor_did), CtorKind::Fn) = path.res {
} else if let Res::Def(DefKind::Ctor(def::CtorOf::Struct, CtorKind::Fn), ctor_did) = path.res {
if self.item_path.res.opt_def_id() == self.cx.tcx.parent(ctor_did) {
span_use_self_lint(self.cx, path);
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn is_potentially_mutated<'a, 'tcx: 'a>(
cx: &'a LateContext<'a, 'tcx>,
) -> bool {
let id = match variable.res {
Res::Local(id) | Res::Def(Res::Upvar(..), id, ..) => id,
Res::Local(id) | Res::Upvar(id, ..) => id,
_ => return true,
};
mutated_variables(expr, cx).map_or(true, |mutated| mutated.contains(&id))
Expand Down

0 comments on commit e43eddc

Please sign in to comment.