Skip to content

Commit d5e2a7a

Browse files
committed
Auto merge of rust-lang#10539 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents c72c914 + 8134414 commit d5e2a7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+177
-218
lines changed

COPYRIGHT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// REUSE-IgnoreStart
2+
13
Copyright 2014-2022 The Rust Project Developers
24

35
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
46
http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
57
<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
68
option. All files in the project carrying such notice may not be
79
copied, modified, or distributed except according to those terms.
10+
11+
// REUSE-IgnoreEnd

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,14 @@ If you want to contribute to Clippy, you can find more information in [CONTRIBUT
275275

276276
## License
277277

278+
<!-- REUSE-IgnoreStart -->
279+
278280
Copyright 2014-2022 The Rust Project Developers
279281

280282
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
281283
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)> or the MIT license
282284
<LICENSE-MIT or [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT)>, at your
283285
option. Files in the project may not be
284286
copied, modified, or distributed except according to those terms.
287+
288+
<!-- REUSE-IgnoreEnd -->

clippy_lints/src/cognitive_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'tcx> LateLintPass<'tcx> for CognitiveComplexity {
143143
span: Span,
144144
def_id: LocalDefId,
145145
) {
146-
if !cx.tcx.has_attr(def_id.to_def_id(), sym::test) {
146+
if !cx.tcx.has_attr(def_id, sym::test) {
147147
let expr = if is_async_fn(kind) {
148148
match get_async_fn_body(cx.tcx, body) {
149149
Some(b) => b,

clippy_lints/src/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
181181
self_ty,
182182
..
183183
}) = item.kind;
184-
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
184+
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
185185
if !item.span.from_expansion();
186186
if let Some(def_id) = trait_ref.trait_def_id();
187187
if cx.tcx.is_diagnostic_item(sym::Default, def_id);

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl<'tcx> LateLintPass<'tcx> for Derive {
212212
}) = item.kind
213213
{
214214
let ty = cx.tcx.type_of(item.owner_id).subst_identity();
215-
let is_automatically_derived = cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
215+
let is_automatically_derived = cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
216216

217217
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
218218
check_ord_partial_ord(cx, item.span, trait_ref, ty, is_automatically_derived);

clippy_lints/src/functions/must_use.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ use super::{DOUBLE_MUST_USE, MUST_USE_CANDIDATE, MUST_USE_UNIT};
2222

2323
pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
2424
let attrs = cx.tcx.hir().attrs(item.hir_id());
25-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
25+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
2626
if let hir::ItemKind::Fn(ref sig, _generics, ref body_id) = item.kind {
2727
let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
2828
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
2929
if let Some(attr) = attr {
3030
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
31-
} else if is_public && !is_proc_macro(cx.sess(), attrs) && !attrs.iter().any(|a| a.has_name(sym::no_mangle)) {
31+
} else if is_public && !is_proc_macro(attrs) && !attrs.iter().any(|a| a.has_name(sym::no_mangle)) {
3232
check_must_use_candidate(
3333
cx,
3434
sig.decl,
@@ -47,13 +47,10 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
4747
let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
4848
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4949
let attrs = cx.tcx.hir().attrs(item.hir_id());
50-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
50+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
5151
if let Some(attr) = attr {
5252
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
53-
} else if is_public
54-
&& !is_proc_macro(cx.sess(), attrs)
55-
&& trait_ref_of_method(cx, item.owner_id.def_id).is_none()
56-
{
53+
} else if is_public && !is_proc_macro(attrs) && trait_ref_of_method(cx, item.owner_id.def_id).is_none() {
5754
check_must_use_candidate(
5855
cx,
5956
sig.decl,
@@ -73,12 +70,12 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7370
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
7471

7572
let attrs = cx.tcx.hir().attrs(item.hir_id());
76-
let attr = cx.tcx.get_attr(item.owner_id.to_def_id(), sym::must_use);
73+
let attr = cx.tcx.get_attr(item.owner_id, sym::must_use);
7774
if let Some(attr) = attr {
7875
check_needless_must_use(cx, sig.decl, item.owner_id, item.span, fn_header_span, attr);
7976
} else if let hir::TraitFn::Provided(eid) = *eid {
8077
let body = cx.tcx.hir().body(eid);
81-
if attr.is_none() && is_public && !is_proc_macro(cx.sess(), attrs) {
78+
if attr.is_none() && is_public && !is_proc_macro(attrs) {
8279
check_must_use_candidate(
8380
cx,
8481
sig.decl,

clippy_lints/src/future_not_send.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::def_id::LocalDefId;
1010
use rustc_span::{sym, Span};
1111
use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
12-
use rustc_trait_selection::traits::{self, FulfillmentError};
12+
use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
1313

1414
declare_clippy_lint! {
1515
/// ### What it does
@@ -79,8 +79,10 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
7979
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
8080
let span = decl.output.span();
8181
let infcx = cx.tcx.infer_ctxt().build();
82+
let ocx = ObligationCtxt::new(&infcx);
8283
let cause = traits::ObligationCause::misc(span, fn_def_id);
83-
let send_errors = traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait);
84+
ocx.register_bound(cause, cx.param_env, ret_ty, send_trait);
85+
let send_errors = ocx.select_all_or_error();
8486
if !send_errors.is_empty() {
8587
span_lint_and_then(
8688
cx,

clippy_lints/src/infinite_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
167167
Finite
168168
},
169169
ExprKind::Block(block, _) => block.expr.as_ref().map_or(Finite, |e| is_infinite(cx, e)),
170-
ExprKind::Box(e) | ExprKind::AddrOf(BorrowKind::Ref, _, e) => is_infinite(cx, e),
170+
ExprKind::AddrOf(BorrowKind::Ref, _, e) => is_infinite(cx, e),
171171
ExprKind::Call(path, _) => {
172172
if let ExprKind::Path(ref qpath) = path.kind {
173173
cx.qpath_res(qpath, path.hir_id)

clippy_lints/src/loops/never_loop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ fn stmt_to_expr<'tcx>(stmt: &Stmt<'tcx>) -> Option<(&'tcx Expr<'tcx>, Option<&'t
124124
#[allow(clippy::too_many_lines)]
125125
fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: HirId) -> NeverLoopResult {
126126
match expr.kind {
127-
ExprKind::Box(e)
128-
| ExprKind::Unary(_, e)
127+
ExprKind::Unary(_, e)
129128
| ExprKind::Cast(e, _)
130129
| ExprKind::Type(e, _)
131130
| ExprKind::Field(e, _)

clippy_lints/src/manual_async_fn.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
2-
use clippy_utils::match_function_call_with_def_id;
32
use clippy_utils::source::{position_before_rarrow, snippet_block, snippet_opt};
43
use if_chain::if_chain;
54
use rustc_errors::Applicability;
@@ -184,16 +183,10 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
184183
fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) -> Option<&'tcx Body<'tcx>> {
185184
if_chain! {
186185
if let Some(block_expr) = block.expr;
187-
if let Some(args) = cx
188-
.tcx
189-
.lang_items()
190-
.identity_future_fn()
191-
.and_then(|def_id| match_function_call_with_def_id(cx, block_expr, def_id));
192-
if args.len() == 1;
193186
if let Expr {
194187
kind: ExprKind::Closure(&Closure { body, .. }),
195188
..
196-
} = args[0];
189+
} = block_expr;
197190
let closure_body = cx.tcx.hir().body(body);
198191
if closure_body.generator_kind == Some(GeneratorKind::Async(AsyncGeneratorKind::Block));
199192
then {

clippy_lints/src/matches/significant_drop_in_scrutinee.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
321321
self.has_significant_drop = true;
322322
}
323323
}
324-
ExprKind::Box(..) |
325324
ExprKind::Array(..) |
326325
ExprKind::Call(..) |
327326
ExprKind::Unary(..) |

clippy_lints/src/methods/unnecessary_sort_by.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ struct SortByKeyDetection {
3333
/// contains a and the other replaces it with b)
3434
fn mirrored_exprs(a_expr: &Expr<'_>, a_ident: &Ident, b_expr: &Expr<'_>, b_ident: &Ident) -> bool {
3535
match (&a_expr.kind, &b_expr.kind) {
36-
// Two boxes with mirrored contents
37-
(ExprKind::Box(left_expr), ExprKind::Box(right_expr)) => {
38-
mirrored_exprs(left_expr, a_ident, right_expr, b_ident)
39-
},
4036
// Two arrays with mirrored contents
4137
(ExprKind::Array(left_exprs), ExprKind::Array(right_exprs)) => {
4238
iter::zip(*left_exprs, *right_exprs).all(|(left, right)| mirrored_exprs(left, a_ident, right, b_ident))

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
369369
Node::Item(item) => {
370370
if let ItemKind::Fn(_, _, body_id) = &item.kind
371371
&& let output_ty = return_ty(cx, item.owner_id)
372-
&& Inherited::build(cx.tcx, item.owner_id.def_id).enter(|inherited| {
373-
let fn_ctxt = FnCtxt::new(inherited, cx.param_env, item.owner_id.def_id);
374-
fn_ctxt.can_coerce(ty, output_ty)
375-
}) {
372+
&& let inherited = Inherited::new(cx.tcx, item.owner_id.def_id)
373+
&& let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, item.owner_id.def_id)
374+
&& fn_ctxt.can_coerce(ty, output_ty)
375+
{
376376
if has_lifetime(output_ty) && has_lifetime(ty) {
377377
return false;
378378
}

clippy_lints/src/no_effect.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
127127
| ExprKind::Type(inner, _)
128128
| ExprKind::Unary(_, inner)
129129
| ExprKind::Field(inner, _)
130-
| ExprKind::AddrOf(_, _, inner)
131-
| ExprKind::Box(inner) => has_no_effect(cx, inner),
130+
| ExprKind::AddrOf(_, _, inner) => has_no_effect(cx, inner),
132131
ExprKind::Struct(_, fields, ref base) => {
133132
!has_drop(cx, cx.typeck_results().expr_ty(expr))
134133
&& fields.iter().all(|field| has_no_effect(cx, field.expr))
@@ -234,8 +233,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<Vec
234233
| ExprKind::Type(inner, _)
235234
| ExprKind::Unary(_, inner)
236235
| ExprKind::Field(inner, _)
237-
| ExprKind::AddrOf(_, _, inner)
238-
| ExprKind::Box(inner) => reduce_expression(cx, inner).or_else(|| Some(vec![inner])),
236+
| ExprKind::AddrOf(_, _, inner) => reduce_expression(cx, inner).or_else(|| Some(vec![inner])),
239237
ExprKind::Struct(_, fields, ref base) => {
240238
if has_drop(cx, cx.typeck_results().expr_ty(expr)) {
241239
None

clippy_lints/src/partialeq_ne_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
3636
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3737
if_chain! {
3838
if let ItemKind::Impl(Impl { of_trait: Some(ref trait_ref), items: impl_items, .. }) = item.kind;
39-
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
39+
if !cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
4040
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
4141
if trait_ref.path.res.def_id() == eq_trait;
4242
then {

clippy_lints/src/shadow.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ fn is_self_shadow(cx: &LateContext<'_>, pat: &Pat<'_>, mut expr: &Expr<'_>, hir_
213213
}
214214
loop {
215215
expr = match expr.kind {
216-
ExprKind::Box(e)
217-
| ExprKind::AddrOf(_, _, e)
216+
ExprKind::AddrOf(_, _, e)
218217
| ExprKind::Block(
219218
&Block {
220219
stmts: [],

clippy_lints/src/significant_drop_tightening.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ impl<'cx, 'sdt, 'tcx> Visitor<'tcx> for SigDropFinder<'cx, 'sdt, 'tcx> {
404404
| hir::ExprKind::Assign(..)
405405
| hir::ExprKind::AssignOp(..)
406406
| hir::ExprKind::Binary(..)
407-
| hir::ExprKind::Box(..)
408407
| hir::ExprKind::Call(..)
409408
| hir::ExprKind::Field(..)
410409
| hir::ExprKind::If(..)

clippy_lints/src/suspicious_operation_groupings.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,7 @@ fn ident_difference_expr_with_base_location(
596596
| (MethodCall(_), MethodCall(_))
597597
| (Call(_, _), Call(_, _))
598598
| (ConstBlock(_), ConstBlock(_))
599-
| (Array(_), Array(_))
600-
| (Box(_), Box(_)) => {
599+
| (Array(_), Array(_)) => {
601600
// keep going
602601
},
603602
_ => {

clippy_lints/src/transmute/utils.rs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,37 @@ pub(super) fn check_cast<'tcx>(
3333
let hir_id = e.hir_id;
3434
let local_def_id = hir_id.owner.def_id;
3535

36-
Inherited::build(cx.tcx, local_def_id).enter(|inherited| {
37-
let fn_ctxt = FnCtxt::new(inherited, cx.param_env, local_def_id);
36+
let inherited = Inherited::new(cx.tcx, local_def_id);
37+
let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);
3838

39-
// If we already have errors, we can't be sure we can pointer cast.
39+
// If we already have errors, we can't be sure we can pointer cast.
40+
assert!(
41+
!fn_ctxt.errors_reported_since_creation(),
42+
"Newly created FnCtxt contained errors"
43+
);
44+
45+
if let Ok(check) = cast::CastCheck::new(
46+
&fn_ctxt,
47+
e,
48+
from_ty,
49+
to_ty,
50+
// We won't show any error to the user, so we don't care what the span is here.
51+
DUMMY_SP,
52+
DUMMY_SP,
53+
hir::Constness::NotConst,
54+
) {
55+
let res = check.do_check(&fn_ctxt);
56+
57+
// do_check's documentation says that it might return Ok and create
58+
// errors in the fcx instead of returning Err in some cases. Those cases
59+
// should be filtered out before getting here.
4060
assert!(
4161
!fn_ctxt.errors_reported_since_creation(),
42-
"Newly created FnCtxt contained errors"
62+
"`fn_ctxt` contained errors after cast check!"
4363
);
4464

45-
if let Ok(check) = cast::CastCheck::new(
46-
&fn_ctxt,
47-
e,
48-
from_ty,
49-
to_ty,
50-
// We won't show any error to the user, so we don't care what the span is here.
51-
DUMMY_SP,
52-
DUMMY_SP,
53-
hir::Constness::NotConst,
54-
) {
55-
let res = check.do_check(&fn_ctxt);
56-
57-
// do_check's documentation says that it might return Ok and create
58-
// errors in the fcx instead of returning Err in some cases. Those cases
59-
// should be filtered out before getting here.
60-
assert!(
61-
!fn_ctxt.errors_reported_since_creation(),
62-
"`fn_ctxt` contained errors after cast check!"
63-
);
64-
65-
res.ok()
66-
} else {
67-
None
68-
}
69-
})
65+
res.ok()
66+
} else {
67+
None
68+
}
7069
}

clippy_lints/src/utils/author.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,6 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
395395
}
396396
self.expr(field!(let_expr.init));
397397
},
398-
ExprKind::Box(inner) => {
399-
bind!(self, inner);
400-
kind!("Box({inner})");
401-
self.expr(inner);
402-
},
403398
ExprKind::Array(elements) => {
404399
bind!(self, elements);
405400
kind!("Array({elements})");

clippy_utils/src/ast_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
143143
(Paren(l), _) => eq_expr(l, r),
144144
(_, Paren(r)) => eq_expr(l, r),
145145
(Err, Err) => true,
146-
(Box(l), Box(r)) | (Try(l), Try(r)) | (Await(l), Await(r)) => eq_expr(l, r),
146+
(Try(l), Try(r)) | (Await(l), Await(r)) => eq_expr(l, r),
147147
(Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)),
148148
(Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)),
149149
(Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value),

clippy_utils/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ pub fn get_unique_attr<'a>(
145145

146146
/// Return true if the attributes contain any of `proc_macro`,
147147
/// `proc_macro_derive` or `proc_macro_attribute`, false otherwise
148-
pub fn is_proc_macro(sess: &Session, attrs: &[ast::Attribute]) -> bool {
149-
attrs.iter().any(|attr| sess.is_proc_macro_attr(attr))
148+
pub fn is_proc_macro(attrs: &[ast::Attribute]) -> bool {
149+
attrs.iter().any(rustc_ast::Attribute::is_proc_macro_attr)
150150
}
151151

152152
/// Return true if the attributes contain `#[doc(hidden)]`

clippy_utils/src/check_proc_macro.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ fn qpath_search_pat(path: &QPath<'_>) -> (Pat, Pat) {
112112
/// Get the search patterns to use for the given expression
113113
fn expr_search_pat(tcx: TyCtxt<'_>, e: &Expr<'_>) -> (Pat, Pat) {
114114
match e.kind {
115-
ExprKind::Box(e) => (Pat::Str("box"), expr_search_pat(tcx, e).1),
116115
ExprKind::ConstBlock(_) => (Pat::Str("const"), Pat::Str("}")),
117116
ExprKind::Tup([]) => (Pat::Str(")"), Pat::Str("(")),
118117
ExprKind::Unary(UnOp::Deref, e) => (Pat::Str("*"), expr_search_pat(tcx, e).1),

clippy_utils/src/eager_or_lazy.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS
199199
},
200200

201201
// Memory allocation, custom operator, loop, or call to an unknown function
202-
ExprKind::Box(_)
203-
| ExprKind::Unary(..)
204-
| ExprKind::Binary(..)
205-
| ExprKind::Loop(..)
206-
| ExprKind::Call(..) => self.eagerness = Lazy,
202+
ExprKind::Unary(..) | ExprKind::Binary(..) | ExprKind::Loop(..) | ExprKind::Call(..) => {
203+
self.eagerness = Lazy;
204+
},
207205

208206
ExprKind::ConstBlock(_)
209207
| ExprKind::Array(_)

clippy_utils/src/hir_utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ impl HirEqInterExpr<'_, '_, '_> {
249249
both(&li.label, &ri.label, |l, r| l.ident.name == r.ident.name)
250250
&& both(le, re, |l, r| self.eq_expr(l, r))
251251
},
252-
(&ExprKind::Box(l), &ExprKind::Box(r)) => self.eq_expr(l, r),
253252
(&ExprKind::Call(l_fun, l_args), &ExprKind::Call(r_fun, r_args)) => {
254253
self.inner.allow_side_effects && self.eq_expr(l_fun, r_fun) && self.eq_exprs(l_args, r_args)
255254
},
@@ -628,7 +627,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
628627
self.hash_expr(j);
629628
}
630629
},
631-
ExprKind::Box(e) | ExprKind::DropTemps(e) | ExprKind::Yield(e, _) => {
630+
ExprKind::DropTemps(e) | ExprKind::Yield(e, _) => {
632631
self.hash_expr(e);
633632
},
634633
ExprKind::Call(fun, args) => {

0 commit comments

Comments
 (0)