about summary refs log tree commit diff
path: root/clippy_lints/src/methods/chars_last_cmp.rs
blob: 07bbc5ca1bf46cdf843966ea89ce87b3378164e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::methods::chars_cmp;
use rustc_lint::LateContext;

use super::CHARS_LAST_CMP;

/// Checks for the `CHARS_LAST_CMP` lint.
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, info: &crate::methods::BinaryExprInfo<'_>) -> bool {
    if chars_cmp::check(cx, info, &["chars", "last"], CHARS_LAST_CMP, "ends_with") {
        true
    } else {
        chars_cmp::check(cx, info, &["chars", "next_back"], CHARS_LAST_CMP, "ends_with")
    }
}