Use correct param env in clippy
This commit is contained in:
parent
ab7d207689
commit
eb7a0f8eb6
2 changed files with 3 additions and 4 deletions
|
@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
|
||||||
// only when assigning `... = Default::default()`
|
// only when assigning `... = Default::default()`
|
||||||
&& is_expr_default(expr, cx)
|
&& is_expr_default(expr, cx)
|
||||||
&& let binding_type = cx.typeck_results().node_type(binding_id)
|
&& 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()
|
&& adt.is_struct()
|
||||||
&& let variant = adt.non_enum_variant()
|
&& let variant = adt.non_enum_variant()
|
||||||
&& (adt.did().is_local() || !variant.is_field_list_non_exhaustive())
|
&& (adt.did().is_local() || !variant.is_field_list_non_exhaustive())
|
||||||
|
@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
|
||||||
.fields
|
.fields
|
||||||
.iter()
|
.iter()
|
||||||
.all(|field| {
|
.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)
|
&& (!has_drop(cx, binding_type) || all_fields_are_copy)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,6 @@ fn into_iter_bound<'tcx>(
|
||||||
param_index: u32,
|
param_index: u32,
|
||||||
node_args: GenericArgsRef<'tcx>,
|
node_args: GenericArgsRef<'tcx>,
|
||||||
) -> Option<Span> {
|
) -> Option<Span> {
|
||||||
let param_env = cx.tcx.param_env(fn_did);
|
|
||||||
let mut into_iter_span = None;
|
let mut into_iter_span = None;
|
||||||
|
|
||||||
for (pred, span) in cx.tcx.explicit_predicates_of(fn_did).predicates {
|
for (pred, span) in cx.tcx.explicit_predicates_of(fn_did).predicates {
|
||||||
|
@ -111,7 +110,7 @@ fn into_iter_bound<'tcx>(
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let predicate = EarlyBinder::bind(tr).instantiate(cx.tcx, args);
|
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
|
if !cx
|
||||||
.tcx
|
.tcx
|
||||||
.infer_ctxt()
|
.infer_ctxt()
|
||||||
|
|
Loading…
Add table
Reference in a new issue