Skip to content

Commit b65050a

Browse files
committed
fix dogfood lints
1 parent e0f2d88 commit b65050a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/unnecessary_split_off.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::sym;
33
use rustc_errors::Applicability;
4-
use rustc_hir::*;
4+
use rustc_hir::{Expr, ExprKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_session::declare_lint_pass;
77

@@ -30,14 +30,15 @@ declare_lint_pass!(UnnecessarySplitOff => [UNNECESSARY_SPLIT_OFF]);
3030
impl<'tcx> LateLintPass<'tcx> for UnnecessarySplitOff {
3131
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
3232
if let ExprKind::MethodCall(path, value, args, span) = &expr.kind
33+
// FIXME: sym::split_off does not exist, but this still triggers the lint to use it.
3334
&& path.ident.name.as_str() == "split_off"
3435
{
3536
let ty = cx.typeck_results().expr_ty(value);
3637
if clippy_utils::ty::is_type_diagnostic_item(cx, ty, sym::Vec) {
3738
let &[arg] = args else {
3839
return;
3940
};
40-
if clippy_utils::is_integer_literal(&arg, 0) || clippy_utils::is_integer_const(cx, &arg, 0) {
41+
if clippy_utils::is_integer_literal(arg, 0) || clippy_utils::is_integer_const(cx, arg, 0) {
4142
span_lint_and_sugg(
4243
cx,
4344
UNNECESSARY_SPLIT_OFF,

0 commit comments

Comments
 (0)