Rollup merge of #79940 - matthiaskrgr:cl15ppy, r=Dylan-DPC
fix more clippy::complexity findings fix clippy::unnecessary_filter_map use if let Some(x) = .. instead of ...map(|x|) to conditionally run fns that return () (clippy::option_map_unit_fn) fix clippy::{needless_bool, manual_unwrap_or} don't clone types that are copy (clippy::clone_on_copy) don't convert types into identical types with .into() (clippy::useless_conversion) use strip_prefix over slicing (clippy::manual_strip) r? ``@Dylan-DPC``
This commit is contained in:
commit
1b81f08d4c
15 changed files with 70 additions and 86 deletions
|
@ -294,17 +294,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
|
||||
closure_captures.insert(*var_hir_id, upvar_id);
|
||||
|
||||
let new_capture_kind = if let Some(capture_kind) =
|
||||
upvar_capture_map.get(&upvar_id)
|
||||
{
|
||||
// upvar_capture_map only stores the UpvarCapture (CaptureKind),
|
||||
// so we create a fake capture info with no expression.
|
||||
let fake_capture_info =
|
||||
ty::CaptureInfo { expr_id: None, capture_kind: capture_kind.clone() };
|
||||
determine_capture_info(fake_capture_info, capture_info).capture_kind
|
||||
} else {
|
||||
capture_info.capture_kind
|
||||
};
|
||||
let new_capture_kind =
|
||||
if let Some(capture_kind) = upvar_capture_map.get(&upvar_id) {
|
||||
// upvar_capture_map only stores the UpvarCapture (CaptureKind),
|
||||
// so we create a fake capture info with no expression.
|
||||
let fake_capture_info =
|
||||
ty::CaptureInfo { expr_id: None, capture_kind: *capture_kind };
|
||||
determine_capture_info(fake_capture_info, capture_info).capture_kind
|
||||
} else {
|
||||
capture_info.capture_kind
|
||||
};
|
||||
upvar_capture_map.insert(upvar_id, new_capture_kind);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2141,13 +2141,8 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
|
|||
// * It must be an associated type for this trait (*not* a
|
||||
// supertrait).
|
||||
if let ty::Projection(projection) = ty.kind() {
|
||||
if projection.substs == trait_identity_substs
|
||||
projection.substs == trait_identity_substs
|
||||
&& tcx.associated_item(projection.item_def_id).container.id() == def_id
|
||||
{
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue