Skip to content

Commit 5d333e8

Browse files
committed
manual_strip: Delay msrv check.
1 parent c0068ba commit 5d333e8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

clippy_lints/src/manual_strip.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,11 @@ enum StripKind {
6666

6767
impl<'tcx> LateLintPass<'tcx> for ManualStrip {
6868
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
69-
if !self.msrv.meets(msrvs::STR_STRIP_PREFIX) {
70-
return;
71-
}
72-
7369
if let Some(higher::If { cond, then, .. }) = higher::If::hir(expr)
7470
&& let ExprKind::MethodCall(_, target_arg, [pattern], _) = cond.kind
75-
&& let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(cond.hir_id)
7671
&& let ExprKind::Path(target_path) = &target_arg.kind
72+
&& self.msrv.meets(msrvs::STR_STRIP_PREFIX)
73+
&& let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(cond.hir_id)
7774
{
7875
let strip_kind = if match_def_path(cx, method_def_id, &paths::STR_STARTS_WITH) {
7976
StripKind::Prefix

0 commit comments

Comments
 (0)