Skip to content

Commit 578cc3d

Browse files
committed
Fix the REGEX_MACRO lint
[rust-lang/regex#183](rust-lang/regex#183) has made the following change that broke the lint: src/re.rs → src/re_unicode.rs
1 parent d6073eb commit 578cc3d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/regex.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use std::error::Error;
99
use syntax::ast::{LitKind, NodeId};
1010
use syntax::codemap::{Span, BytePos};
1111
use syntax::parse::token::InternedString;
12-
use utils::paths;
13-
use utils::{is_expn_of, match_path, match_type, span_lint, span_help_and_lint};
12+
use utils::{is_expn_of, match_path, match_type, paths, span_lint, span_help_and_lint};
1413

1514
/// **What it does:** This lint checks `Regex::new(_)` invocations for correct regex syntax.
1615
///
@@ -73,8 +72,8 @@ impl LateLintPass for RegexPass {
7372
if_let_chain!{[
7473
self.last.is_none(),
7574
let Some(ref expr) = block.expr,
76-
match_type(cx, cx.tcx.expr_ty(expr), &["regex", "re", "Regex"]),
77-
let Some(span) = is_expn_of(cx, expr.span, "regex")
75+
match_type(cx, cx.tcx.expr_ty(expr), &paths::REGEX),
76+
let Some(span) = is_expn_of(cx, expr.span, "regex"),
7877
], {
7978
if !self.spans.contains(&span) {
8079
span_lint(cx,

src/utils/paths.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub const RANGE_INCLUSIVE_NON_EMPTY: [&'static str; 4] = ["std", "ops", "RangeIn
2929
pub const RANGE: [&'static str; 3] = ["std", "ops", "Range"];
3030
pub const RANGE_TO_INCLUSIVE: [&'static str; 3] = ["std", "ops", "RangeToInclusive"];
3131
pub const RANGE_TO: [&'static str; 3] = ["std", "ops", "RangeTo"];
32+
pub const REGEX: [&'static str; 3] = ["regex", "re_unicode", "Regex"];
3233
pub const REGEX_NEW: [&'static str; 3] = ["regex", "Regex", "new"];
3334
pub const RESULT: [&'static str; 3] = ["core", "result", "Result"];
3435
pub const STRING: [&'static str; 3] = ["collections", "string", "String"];

0 commit comments

Comments
 (0)