1
Fork 0
This commit is contained in:
csmoe 2018-07-12 15:30:57 +08:00 committed by Oliver Schneider
parent 2a016890a0
commit 1bd17e4fa2
90 changed files with 777 additions and 777 deletions

View file

@ -108,8 +108,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_chain! {
if let ExprCall(ref fun, ref args) = expr.node;
if let ExprPath(ref qpath) = fun.node;
if let ExprKind::Call(ref fun, ref args) = expr.node;
if let ExprKind::Path(ref qpath) = fun.node;
if args.len() == 1;
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, fun.hir_id));
then {
@ -176,8 +176,8 @@ 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 ExprAddrOf(_, ref expr) = expr.node;
if let ExprArray(ref exprs) = expr.node;
if let ExprKind::AddrOf(_, ref expr) = expr.node;
if let ExprKind::Array(ref exprs) = expr.node;
then {
for expr in exprs {
check_regex(cx, expr, utf8);
@ -192,7 +192,7 @@ fn check_regex<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, utf8: boo
.allow_invalid_utf8(!utf8)
.build();
if let ExprLit(ref lit) = expr.node {
if let ExprKind::Lit(ref lit) = expr.node {
if let LitKind::Str(ref r, style) = lit.node {
let r = &r.as_str();
let offset = if let StrStyle::Raw(n) = style { 2 + n } else { 1 };