From 24a2c14733604132135b2ab598e7a1cf95d8b3ab Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Mon, 23 Oct 2017 15:20:58 -0400 Subject: [PATCH] remove if_let_chain --- clippy_lints/Cargo.toml | 1 + clippy_lints/src/lib.rs | 5 +++ clippy_lints/src/utils/mod.rs | 57 ----------------------------------- 3 files changed, 6 insertions(+), 57 deletions(-) diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index 414cd68a660..2dcac941c09 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -28,6 +28,7 @@ toml = "0.4" unicode-normalization = "0.1" pulldown-cmark = "0.0.15" url = "1.5.0" +if_chain = "0.1" [features] debugging = [] diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 27ef37dd00f..1cd3479f11d 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -11,6 +11,8 @@ #![feature(inclusive_range_syntax, range_contains)] #![allow(unknown_lints, indexing_slicing, shadow_reuse, missing_docs_in_private_items)] +#![recursion_limit="256"] + #[macro_use] extern crate rustc; extern crate rustc_typeck; @@ -54,6 +56,9 @@ extern crate itertools; extern crate pulldown_cmark; extern crate url; +#[macro_use] +extern crate if_chain; + macro_rules! declare_restriction_lint { { pub $name:tt, $description:tt } => { declare_lint! { pub $name, Allow, $description } diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 9bc87dee68c..e0ed6689458 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -37,63 +37,6 @@ pub use self::hir_utils::{SpanlessEq, SpanlessHash}; pub type MethodArgs = HirVec>; -/// Produce a nested chain of if-lets and ifs from the patterns: -/// -/// ```rust,ignore -/// if_let_chain! {[ -/// let Some(y) = x, -/// y.len() == 2, -/// let Some(z) = y, -/// ], { -/// block -/// }} -/// ``` -/// -/// becomes -/// -/// ```rust,ignore -/// if let Some(y) = x { -/// if y.len() == 2 { -/// if let Some(z) = y { -/// block -/// } -/// } -/// } -/// ``` -#[macro_export] -macro_rules! if_let_chain { - ([let $pat:pat = $expr:expr, $($tt:tt)+], $block:block) => { - if let $pat = $expr { - if_let_chain!{ [$($tt)+], $block } - } - }; - ([let $pat:pat = $expr:expr], $block:block) => { - if let $pat = $expr { - $block - } - }; - ([let $pat:pat = $expr:expr,], $block:block) => { - if let $pat = $expr { - $block - } - }; - ([$expr:expr, $($tt:tt)+], $block:block) => { - if $expr { - if_let_chain!{ [$($tt)+], $block } - } - }; - ([$expr:expr], $block:block) => { - if $expr { - $block - } - }; - ([$expr:expr,], $block:block) => { - if $expr { - $block - } - }; -} - pub mod higher; /// Returns true if the two spans come from differing expansions (i.e. one is