]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/regex.rs
Auto merge of #4947 - rust-lang:doc-main-extern-crate, r=flip1995
[rust.git] / clippy_lints / src / regex.rs
index 54220f1107b7376e71f1251d480a58160f3bf767..c60912ddb2cac57b7ec61ce42017b80b0a6d3309 100644 (file)
@@ -1,11 +1,11 @@
 use crate::consts::{constant, Constant};
 use crate::utils::{is_expn_of, match_def_path, match_type, paths, span_help_and_lint, span_lint};
 use if_chain::if_chain;
-use regex_syntax;
 use rustc::hir::*;
+use rustc::impl_lint_pass;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
-use rustc::{declare_tool_lint, impl_lint_pass};
 use rustc_data_structures::fx::FxHashSet;
+use rustc_session::declare_tool_lint;
 use std::convert::TryFrom;
 use syntax::ast::{LitKind, StrStyle};
 use syntax::source_map::{BytePos, Span};
@@ -75,7 +75,7 @@ pub struct Regex {
 impl_lint_pass!(Regex => [INVALID_REGEX, REGEX_MACRO, TRIVIAL_REGEX]);
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Regex {
-    fn check_crate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate) {
+    fn check_crate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate<'_>) {
         self.spans.clear();
     }
 
@@ -186,7 +186,7 @@ fn is_trivial_regex(s: &regex_syntax::hir::Hir) -> Option<&'static str> {
 
 fn check_set<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, utf8: bool) {
     if_chain! {
-        if let ExprKind::AddrOf(_, ref expr) = expr.kind;
+        if let ExprKind::AddrOf(BorrowKind::Ref, _, ref expr) = expr.kind;
         if let ExprKind::Array(ref exprs) = expr.kind;
         then {
             for expr in exprs {