Skip to content

Commit 68fe39c

Browse files
committed
adjust applicability
Signed-off-by: tabokie <[email protected]>
1 parent 5796501 commit 68fe39c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clippy_lints/src/assertions_on_result_states.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare_clippy_lint! {
2626
#[clippy::version = "1.64.0"]
2727
pub ASSERTIONS_ON_RESULT_STATES,
2828
style,
29-
"`assert!(r.is_ok())` gives worse error message than directly calling `r.unwrap()`"
29+
"`assert!(r.is_ok())`/`assert!(r.is_err())` gives worse error message than directly calling `r.unwrap()`/`r.unwrap_err()`"
3030
}
3131

3232
declare_lint_pass!(AssertionsOnResultStates => [ASSERTIONS_ON_RESULT_STATES]);
@@ -54,7 +54,7 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnResultStates {
5454
"{}.unwrap()",
5555
method_receiver_snippet
5656
),
57-
Applicability::MachineApplicable,
57+
Applicability::MaybeIncorrect,
5858
);
5959
} else if method_segment.ident.name == sym!(is_err)
6060
&& let Some(value_type) = get_result_child_type(cx, result_type, false /*err*/)
@@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnResultStates {
7070
"{}.unwrap_err()",
7171
method_receiver_snippet
7272
),
73-
Applicability::MachineApplicable,
73+
Applicability::MaybeIncorrect,
7474
);
7575
}
7676
}
@@ -84,7 +84,7 @@ fn get_result_child_type<'a>(cx: &LateContext<'_>, ty: Ty<'a>, err: bool) -> Opt
8484
if err {
8585
substs.types().nth(1)
8686
} else {
87-
substs.types().nth(0)
87+
substs.types().next()
8888
}
8989
},
9090
_ => None,

0 commit comments

Comments
 (0)