blob: 027d0a3947bfbd3881c45b1abf6111d651b9f4cc [file]
use crate::methods::chars_cmp_with_unwrap;
use clippy_utils::sym;
use rustc_lint::LateContext;
use super::CHARS_LAST_CMP;
/// Checks for the `CHARS_LAST_CMP` lint with `unwrap()`.
pub(super) fn check(cx: &LateContext<'_>, info: &crate::methods::BinaryExprInfo<'_>) -> bool {
if chars_cmp_with_unwrap::check(
cx,
info,
&[sym::chars, sym::last, sym::unwrap],
CHARS_LAST_CMP,
"ends_with",
) {
true
} else {
chars_cmp_with_unwrap::check(
cx,
info,
&[sym::chars, sym::next_back, sym::unwrap],
CHARS_LAST_CMP,
"ends_with",
)
}
}