map_clone

This commit is contained in:
Johann Hemmann 2024-01-19 14:28:37 +01:00
parent 6709eaba2a
commit eb7aec5a8e
2 changed files with 2 additions and 5 deletions

View File

@ -180,7 +180,6 @@ from_str_radix_10 = "allow"
get_first = "allow" get_first = "allow"
if_same_then_else = "allow" if_same_then_else = "allow"
large_enum_variant = "allow" large_enum_variant = "allow"
map_clone = "allow"
match_like_matches_macro = "allow" match_like_matches_macro = "allow"
match_single_binding = "allow" match_single_binding = "allow"
needless_borrow = "allow" needless_borrow = "allow"

View File

@ -197,10 +197,8 @@ impl SourceAnalyzer {
) -> Option<(Type, Option<Type>)> { ) -> Option<(Type, Option<Type>)> {
let pat_id = self.pat_id(pat)?; let pat_id = self.pat_id(pat)?;
let infer = self.infer.as_ref()?; let infer = self.infer.as_ref()?;
let coerced = infer let coerced =
.pat_adjustments infer.pat_adjustments.get(&pat_id).and_then(|adjusts| adjusts.last().cloned());
.get(&pat_id)
.and_then(|adjusts| adjusts.last().map(|adjust| adjust.clone()));
let ty = infer[pat_id].clone(); let ty = infer[pat_id].clone();
let mk_ty = |ty| Type::new_with_resolver(db, &self.resolver, ty); let mk_ty = |ty| Type::new_with_resolver(db, &self.resolver, ty);
Some((mk_ty(ty), coerced.map(mk_ty))) Some((mk_ty(ty), coerced.map(mk_ty)))