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 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
.iter() .iter()
.flatten() .flatten()
.map(|r| r.impl_blocks.len() as isize - avg as isize) .map(|r| r.impl_blocks.len() as isize - avg as isize)
.map(|v| v.abs() as usize) .map(|v| v.unsigned_abs())
.sum::<usize>(); .sum::<usize>();
s / connected_regions.len() s / connected_regions.len()
}, },

View File

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

View File

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