Reduce redundant `TypeId` creation
@@ -124,13 +124,9 @@ impl TypeId {
}
pub(crate) fn update_type(&mut self, type_mapping: &TypeMapping, span: &Span) {
- *self = match look_up_type_id(*self).matches_type_parameter(type_mapping) {
- Some(matching_id) => insert_type(TypeInfo::Ref(matching_id, span.clone())),
- None => {
- let ty = TypeInfo::Ref(insert_type(look_up_type_id_raw(*self)), span.clone());
- insert_type(ty)
+ if let Some(matching_id) = look_up_type_id(*self).matches_type_parameter(type_mapping) {
+ *self = insert_type(TypeInfo::Ref(matching_id, span.clone()));
}
- };
}
pub(crate) fn get_type_parameters(&self) -> Option<Vec<TypeParameter>> {
