Fix the REGEX_MACRO lint

[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
This commit is contained in:
mcarton 2016-04-15 00:09:37 +02:00
parent d6073eb54e
commit 578cc3dc71
2 changed files with 4 additions and 4 deletions

View File

@ -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,

View File

@ -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"];