Small clippy::correctness fixes

Nothing was really incorrect before, but it did get nicer.
This commit is contained in:
Nilstrieb 2023-04-09 22:31:48 +02:00
parent 0a0968b207
commit 07cd3826e0
3 changed files with 4 additions and 6 deletions

View File

@ -302,7 +302,7 @@ struct ConnectedRegion {
.iter()
.flatten()
.map(|r| r.impl_blocks.len() as isize - avg as isize)
.map(|v| v.abs() as usize)
.map(|v| v.unsigned_abs())
.sum::<usize>();
s / connected_regions.len()
},

View File

@ -313,8 +313,7 @@ pub fn resolve_interior<'a, 'tcx>(
// Extract type components to build the witness type.
let type_list = fcx.tcx.mk_type_list_from_iter(type_causes.iter().map(|cause| cause.ty));
let bound_vars = fcx.tcx.mk_bound_variable_kinds(&bound_vars);
let witness =
fcx.tcx.mk_generator_witness(ty::Binder::bind_with_vars(type_list, bound_vars.clone()));
let witness = fcx.tcx.mk_generator_witness(ty::Binder::bind_with_vars(type_list, bound_vars));
drop(typeck_results);
// Store the generator types and spans into the typeck results for this generator.

View File

@ -1755,7 +1755,6 @@ fn collapse_candidates_to_trait_pick(
fn probe_for_similar_candidate(&mut self) -> Result<Option<ty::AssocItem>, MethodError<'tcx>> {
debug!("probing for method names similar to {:?}", self.method_name);
let steps = self.steps.clone();
self.probe(|_| {
let mut pcx = ProbeContext::new(
self.fcx,
@ -1763,8 +1762,8 @@ fn probe_for_similar_candidate(&mut self) -> Result<Option<ty::AssocItem>, Metho
self.mode,
self.method_name,
self.return_type,
&self.orig_steps_var_values,
steps,
self.orig_steps_var_values,
self.steps,
self.scope_expr_id,
);
pcx.allow_similar_names = true;