Skip to content

Commit

Permalink
Update clippy_lints/src/methods/mod.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Krones <hello@philkrones.com>
  • Loading branch information
rsulli55 and flip1995 authored Oct 11, 2020
1 parent b72e769 commit a46b437
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3105,15 +3105,16 @@ fn lint_search_is_some<'tcx>(
let msg = "called `is_some()` after calling `find()` \
on a string. This is more succinctly expressed by calling \
`contains()`.".to_string();
let find_arg = snippet(cx, search_args[1].span, "..");
let mut applicability = Applicability::MachineApplicable;
let find_arg = snippet_with_applicability(cx, search_args[1].span, "..", &mut applicability);
span_lint_and_sugg(
cx,
SEARCH_IS_SOME,
method_span.with_hi(expr.span.hi()),
&msg,
"try this",
format!("contains({})", find_arg),
Applicability::MachineApplicable,
applicability,
);
}
}
Expand Down

0 comments on commit a46b437

Please sign in to comment.