Skip to content

Commit 4d20f8c

Browse files
committed
Apply review feedback
1 parent c0c5a76 commit 4d20f8c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clippy_lints/src/unused_result_ok.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_span::sym;
1010

1111
declare_clippy_lint! {
1212
/// ### What it does
13-
/// Checks for `Result::ok();` when the result is not captured.
13+
/// Checks for calls to `Result::ok()` without using the returned `Option`.
1414
///
1515
/// ### Why is this bad?
1616
/// Using `Result::ok()` may look like the result is checked like `unwrap` or `expect` would do
@@ -35,14 +35,14 @@ declare_lint_pass!(UnusedResultOk => [UNUSED_RESULT_OK]);
3535

3636
impl LateLintPass<'_> for UnusedResultOk {
3737
fn check_stmt(&mut self, cx: &LateContext<'_>, stmt: &Stmt<'_>) {
38-
if let StmtKind::Semi(expr) = stmt.kind &&
39-
let ExprKind::MethodCall(ok_path, recv, [], ..) = expr.kind //check is expr.ok() has type Result<T,E>.ok(, _)
38+
if let StmtKind::Semi(expr) = stmt.kind
39+
&& let ExprKind::MethodCall(ok_path, recv, [], ..) = expr.kind //check is expr.ok() has type Result<T,E>.ok(, _)
4040
&& ok_path.ident.as_str() == "ok"
4141
&& is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(recv), sym::Result)
4242
&& !in_external_macro(cx.sess(), stmt.span)
4343
{
4444
let ctxt = expr.span.ctxt();
45-
let mut applicability = Applicability::MachineApplicable;
45+
let mut applicability = Applicability::MaybeIncorrect;
4646
let snippet = snippet_with_context(cx, recv.span, ctxt, "", &mut applicability).0;
4747
let sugg = format!("let _ = {snippet}");
4848
span_lint_and_sugg(

0 commit comments

Comments
 (0)