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