From a854874e6a089f67a658a4f5bb4b0d7150535573 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 18 Apr 2018 20:25:43 +0200 Subject: [PATCH] Fix latest nightly breakage I'm not sure if there are better ways to use the RwLock API, though. But it seems to work. --- clippy_lints/src/loops.rs | 2 +- src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index cfef1e85b..515bd8976 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1798,7 +1798,7 @@ fn is_ref_iterable_type(cx: &LateContext, e: &Expr) -> bool { fn is_iterable_array(ty: Ty) -> bool { // IntoIterator is currently only implemented for array sizes <= 32 in rustc match ty.sty { - ty::TyArray(_, n) => (0..=32).contains(n.val.to_raw_bits().expect("array length")), + ty::TyArray(_, n) => (0..=32).contains(&n.val.to_raw_bits().expect("array length")), _ => false, } } diff --git a/src/lib.rs b/src/lib.rs index 8f0c6a632..f8682884a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ extern crate clippy_lints; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { - if let Ok(lint_store) = reg.sess.lint_store.try_borrow() { + reg.sess.lint_store.with_read_lock(|lint_store| { for (lint, _, _) in lint_store.get_lint_groups() { if lint == "clippy" { reg.sess @@ -21,7 +21,7 @@ pub fn plugin_registrar(reg: &mut Registry) { return; } } - } + }); clippy_lints::register_plugins(reg); }