diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index d80f9f3d5..fab15ac32 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -339,15 +339,15 @@ fn all_ranges(cx: &LateContext, arms: &[Arm]) -> Vec> { Some(pats.iter().filter_map(|pat| { if_let_chain! {[ let PatKind::Range(ref lhs, ref rhs) = pat.node, - let Ok(lhs) = eval_const_expr_partial(cx.tcx, &lhs, ExprTypeChecked, None), - let Ok(rhs) = eval_const_expr_partial(cx.tcx, &rhs, ExprTypeChecked, None) + let Ok(lhs) = eval_const_expr_partial(cx.tcx, lhs, ExprTypeChecked, None), + let Ok(rhs) = eval_const_expr_partial(cx.tcx, rhs, ExprTypeChecked, None) ], { return Some(SpannedRange { span: pat.span, node: (lhs, rhs) }); }} if_let_chain! {[ let PatKind::Lit(ref value) = pat.node, - let Ok(value) = eval_const_expr_partial(cx.tcx, &value, ExprTypeChecked, None) + let Ok(value) = eval_const_expr_partial(cx.tcx, value, ExprTypeChecked, None) ], { return Some(SpannedRange { span: pat.span, node: (value.clone(), value) }); }} diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index fb59c8c61..8b84f94fa 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -104,13 +104,11 @@ impl LateLintPass for RegexPass { let Some(def) = cx.tcx.def_map.borrow().get(&fun.id), ], { let def_id = def.def_id(); - if match_def_path(cx, def_id, &paths::REGEX_NEW) { + if match_def_path(cx, def_id, &paths::REGEX_NEW) || + match_def_path(cx, def_id, &paths::REGEX_BUILDER_NEW) { check_regex(cx, &args[0], true); - } else if match_def_path(cx, def_id, &paths::REGEX_BYTES_NEW) { - check_regex(cx, &args[0], false); - } else if match_def_path(cx, def_id, &paths::REGEX_BUILDER_NEW) { - check_regex(cx, &args[0], true); - } else if match_def_path(cx, def_id, &paths::REGEX_BYTES_BUILDER_NEW) { + } else if match_def_path(cx, def_id, &paths::REGEX_BYTES_NEW) || + match_def_path(cx, def_id, &paths::REGEX_BYTES_BUILDER_NEW) { check_regex(cx, &args[0], false); } else if match_def_path(cx, def_id, &paths::REGEX_SET_NEW) { check_set(cx, &args[0], true);