From 578cc3dc71134594da58a606acce1ef03883fee3 Mon Sep 17 00:00:00 2001
From: mcarton <cartonmartin+git@gmail.com>
Date: Fri, 15 Apr 2016 00:09:37 +0200
Subject: [PATCH] Fix the `REGEX_MACRO` lint
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[rust-lang-nursery/regex#183](https://github.com/rust-lang-nursery/regex/pull/183) has made the following change that broke the lint:

src/re.rs → src/re_unicode.rs
---
 src/regex.rs       | 7 +++----
 src/utils/paths.rs | 1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/regex.rs b/src/regex.rs
index 3bd17a2d365..72a33757027 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -9,8 +9,7 @@ use std::error::Error;
 use syntax::ast::{LitKind, NodeId};
 use syntax::codemap::{Span, BytePos};
 use syntax::parse::token::InternedString;
-use utils::paths;
-use utils::{is_expn_of, match_path, match_type, span_lint, span_help_and_lint};
+use utils::{is_expn_of, match_path, match_type, paths, span_lint, span_help_and_lint};
 
 /// **What it does:** This lint checks `Regex::new(_)` invocations for correct regex syntax.
 ///
@@ -73,8 +72,8 @@ impl LateLintPass for RegexPass {
         if_let_chain!{[
             self.last.is_none(),
             let Some(ref expr) = block.expr,
-            match_type(cx, cx.tcx.expr_ty(expr), &["regex", "re", "Regex"]),
-            let Some(span) = is_expn_of(cx, expr.span, "regex")
+            match_type(cx, cx.tcx.expr_ty(expr), &paths::REGEX),
+            let Some(span) = is_expn_of(cx, expr.span, "regex"),
         ], {
             if !self.spans.contains(&span) {
                 span_lint(cx,
diff --git a/src/utils/paths.rs b/src/utils/paths.rs
index 1777c31ef8c..88d0dd415aa 100644
--- a/src/utils/paths.rs
+++ b/src/utils/paths.rs
@@ -29,6 +29,7 @@ pub const RANGE_INCLUSIVE_NON_EMPTY: [&'static str; 4] = ["std", "ops", "RangeIn
 pub const RANGE: [&'static str; 3] = ["std", "ops", "Range"];
 pub const RANGE_TO_INCLUSIVE: [&'static str; 3] = ["std", "ops", "RangeToInclusive"];
 pub const RANGE_TO: [&'static str; 3] = ["std", "ops", "RangeTo"];
+pub const REGEX: [&'static str; 3] = ["regex", "re_unicode", "Regex"];
 pub const REGEX_NEW: [&'static str; 3] = ["regex", "Regex", "new"];
 pub const RESULT: [&'static str; 3] = ["core", "result", "Result"];
 pub const STRING: [&'static str; 3] = ["collections", "string", "String"];