Skip to content

Commit ae9d202

Browse files
committed
Remove QPath::LangItem from ranges
1 parent bc5bd29 commit ae9d202

24 files changed

+49
-46
lines changed

clippy_lints/src/indexing_slicing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
124124
let note = "the suggestion might not be applicable in constant blocks";
125125
let ty = cx.typeck_results().expr_ty(array).peel_refs();
126126
let allowed_in_tests = self.allow_indexing_slicing_in_tests && is_in_test(cx.tcx, expr.hir_id);
127-
if let Some(range) = higher::Range::hir(index) {
127+
if let Some(range) = higher::Range::hir(cx, index) {
128128
// Ranged indexes, i.e., &x[n..m], &x[n..], &x[..n] and &x[..]
129129
if let ty::Array(_, s) = ty.kind() {
130130
let size: u128 = if let Some(size) = s.try_to_target_usize(cx.tcx) {

clippy_lints/src/infinite_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
178178
Finite
179179
}
180180
},
181-
ExprKind::Struct(..) => higher::Range::hir(expr).is_some_and(|r| r.end.is_none()).into(),
181+
ExprKind::Struct(..) => higher::Range::hir(cx, expr).is_some_and(|r| r.end.is_none()).into(),
182182
_ => Finite,
183183
}
184184
}

clippy_lints/src/loops/char_indices_as_byte_indices.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn check_index_usage<'tcx>(
131131
fn index_consumed_at<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> {
132132
for (_, node) in cx.tcx.hir_parent_iter(expr.hir_id) {
133133
match node {
134-
Node::Expr(expr) if higher::Range::hir(expr).is_some() => {},
134+
Node::Expr(expr) if higher::Range::hir(cx, expr).is_some() => {},
135135
Node::ExprField(_) => {},
136136
Node::Expr(expr) => return Some(expr),
137137
_ => break,

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(super) fn check<'tcx>(
2929
end: Some(end),
3030
limits,
3131
span: _,
32-
}) = higher::Range::hir(arg)
32+
}) = higher::Range::hir(cx, arg)
3333
// the var must be a single name
3434
&& let PatKind::Binding(_, canonical_id, _, _) = pat.kind
3535
{

clippy_lints/src/loops/manual_slice_fill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(super) fn check<'tcx>(
3232
end: Some(end),
3333
limits: RangeLimits::HalfOpen,
3434
span: _,
35-
}) = higher::Range::hir(arg)
35+
}) = higher::Range::hir(cx, arg)
3636
&& let ExprKind::Lit(Spanned {
3737
node: LitKind::Int(Pu128(0), _),
3838
..

clippy_lints/src/loops/mut_range_bound.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(super) fn check(cx: &LateContext<'_>, arg: &Expr<'_>, body: &Expr<'_>) {
1616
start: Some(start),
1717
end: Some(end),
1818
..
19-
}) = higher::Range::hir(arg)
19+
}) = higher::Range::hir(cx, arg)
2020
&& let (mut_id_start, mut_id_end) = (check_for_mutability(cx, start), check_for_mutability(cx, end))
2121
&& (mut_id_start.is_some() || mut_id_end.is_some())
2222
{

clippy_lints/src/loops/needless_range_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(super) fn check<'tcx>(
3131
ref end,
3232
limits,
3333
span,
34-
}) = higher::Range::hir(arg)
34+
}) = higher::Range::hir(cx, arg)
3535
// the var must be a single name
3636
&& let PatKind::Binding(_, canonical_id, ident, _) = pat.kind
3737
{

clippy_lints/src/loops/single_element_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub(super) fn check<'tcx>(
9090
arg_snip = format!("({arg_snip})").into();
9191
}
9292

93-
if clippy_utils::higher::Range::hir(arg_expression).is_some() {
93+
if clippy_utils::higher::Range::hir(cx, arg_expression).is_some() {
9494
let range_expr = snippet(cx, arg_expression.span, "?").to_string();
9595

9696
let sugg = snippet(cx, arg_expression.span, "..");

clippy_lints/src/manual_is_ascii_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualIsAsciiCheck {
111111
end: Some(end),
112112
limits: RangeLimits::Closed,
113113
span: _,
114-
}) = higher::Range::hir(receiver)
114+
}) = higher::Range::hir(cx, receiver)
115115
&& !matches!(cx.typeck_results().expr_ty(arg).peel_refs().kind(), ty::Param(_))
116116
{
117117
let arg = peel_ref_operators(cx, arg);

clippy_lints/src/manual_option_as_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn is_empty_slice(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
207207
ExprKind::Index(arr, range, _) => match arr.kind {
208208
ExprKind::Array([]) => is_range_literal(range),
209209
ExprKind::Array(_) => {
210-
let Some(range) = clippy_utils::higher::Range::hir(range) else {
210+
let Some(range) = clippy_utils::higher::Range::hir(cx, range) else {
211211
return false;
212212
};
213213
range.end.is_some_and(|e| clippy_utils::is_integer_const(cx, e, 0))

0 commit comments

Comments
 (0)