1
Fork 0

Replace &Vec<_>s with &[_]s

This commit is contained in:
Maybe Waffle 2022-06-03 20:42:42 +04:00
parent e40d5e83dc
commit afaa9854fa
14 changed files with 53 additions and 45 deletions

View file

@ -133,7 +133,7 @@ fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
/// ancestor of `foo.x.y`. It's the caller's responsibility to ensure that both projections
/// list are being applied to the same root variable.
fn is_ancestor_or_same_capture(
proj_possible_ancestor: &Vec<HirProjectionKind>,
proj_possible_ancestor: &[HirProjectionKind],
proj_capture: &[HirProjectionKind],
) -> bool {
// We want to make sure `is_ancestor_or_same_capture("x.0.0", "x.0")` to return false.
@ -187,7 +187,7 @@ fn find_capture_matching_projections<'a, 'tcx>(
// If an ancestor is found, `idx` is the index within the list of captured places
// for root variable `var_hir_id` and `capture` is the `ty::CapturedPlace` itself.
let (idx, capture) = root_variable_min_captures.iter().enumerate().find(|(_, capture)| {
let possible_ancestor_proj_kinds =
let possible_ancestor_proj_kinds: Vec<_> =
capture.place.projections.iter().map(|proj| proj.kind).collect();
is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections)
})?;

View file

@ -409,7 +409,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
outer_source_info: SourceInfo,
candidate: Candidate<'_, 'tcx>,
guard: Option<&Guard<'tcx>>,
fake_borrow_temps: &Vec<(Place<'tcx>, Local)>,
fake_borrow_temps: &[(Place<'tcx>, Local)],
scrutinee_span: Span,
arm_span: Option<Span>,
arm_scope: Option<region::Scope>,
@ -1826,7 +1826,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
candidate: Candidate<'pat, 'tcx>,
parent_bindings: &[(Vec<Binding<'tcx>>, Vec<Ascription<'tcx>>)],
guard: Option<&Guard<'tcx>>,
fake_borrows: &Vec<(Place<'tcx>, Local)>,
fake_borrows: &[(Place<'tcx>, Local)],
scrutinee_span: Span,
arm_span: Option<Span>,
match_scope: Option<region::Scope>,