9007: Internal: `clippy::redundant_clone` fixes r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2021-05-26 15:36:14 +00:00 committed by GitHub
commit f3aaae6555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 27 deletions

View file

@ -44,7 +44,7 @@ impl<'a> InferenceContext<'a> {
if !could_unify {
self.result.type_mismatches.insert(
tgt_expr.into(),
TypeMismatch { expected: expected_ty.clone(), actual: ty.clone() },
TypeMismatch { expected: expected_ty, actual: ty.clone() },
);
}
}
@ -57,15 +57,14 @@ impl<'a> InferenceContext<'a> {
let ty = self.infer_expr_inner(expr, &expected);
let ty = if let Some(target) = expected.only_has_type(&mut self.table) {
if !self.coerce(&ty, &target) {
self.result.type_mismatches.insert(
expr.into(),
TypeMismatch { expected: target.clone(), actual: ty.clone() },
);
self.result
.type_mismatches
.insert(expr.into(), TypeMismatch { expected: target, actual: ty.clone() });
// Return actual type when type mismatch.
// This is needed for diagnostic when return type mismatch.
ty
} else {
target.clone()
target
}
} else {
ty