]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/clippy_lints/src/methods/single_char_add_str.rs
Auto merge of #105436 - nnethercote:inline-place_contents_drop_state_cannot_differ...
[rust.git] / src / tools / clippy / clippy_lints / src / methods / single_char_add_str.rs
1 use crate::methods::{single_char_insert_string, single_char_push_string};
2 use clippy_utils::{match_def_path, paths};
3 use rustc_hir as hir;
4 use rustc_lint::LateContext;
5
6 pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, receiver: &hir::Expr<'_>, args: &[hir::Expr<'_>]) {
7     if let Some(fn_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) {
8         if match_def_path(cx, fn_def_id, &paths::PUSH_STR) {
9             single_char_push_string::check(cx, expr, receiver, args);
10         } else if match_def_path(cx, fn_def_id, &paths::INSERT_STR) {
11             single_char_insert_string::check(cx, expr, receiver, args);
12         }
13     }
14 }