Skip to content

Commit

Permalink
Use correct param env in clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Feb 7, 2024
1 parent ab7d207 commit eb7a0f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
// only when assigning `... = Default::default()`
&& is_expr_default(expr, cx)
&& let binding_type = cx.typeck_results().node_type(binding_id)
&& let Some(adt) = binding_type.ty_adt_def()
&& let ty::Adt(adt, args) = *binding_type.kind()
&& adt.is_struct()
&& let variant = adt.non_enum_variant()
&& (adt.did().is_local() || !variant.is_field_list_non_exhaustive())
Expand All @@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
.fields
.iter()
.all(|field| {
is_copy(cx, cx.tcx.type_of(field.did).instantiate_identity())
is_copy(cx, cx.tcx.type_of(field.did).instantiate(cx.tcx, args))
})
&& (!has_drop(cx, binding_type) || all_fields_are_copy)
{
Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/useless_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ fn into_iter_bound<'tcx>(
param_index: u32,
node_args: GenericArgsRef<'tcx>,
) -> Option<Span> {
let param_env = cx.tcx.param_env(fn_did);
let mut into_iter_span = None;

for (pred, span) in cx.tcx.explicit_predicates_of(fn_did).predicates {
Expand All @@ -111,7 +110,7 @@ fn into_iter_bound<'tcx>(
}));

let predicate = EarlyBinder::bind(tr).instantiate(cx.tcx, args);
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), param_env, predicate);
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
if !cx
.tcx
.infer_ctxt()
Expand Down

0 comments on commit eb7a0f8

Please sign in to comment.