mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
cleaning
This commit is contained in:
parent
3bba811e92
commit
0a80cc82b1
@ -241,7 +241,9 @@ impl TypeRef {
|
|||||||
fn go(type_ref: &TypeRef, f: &mut impl FnMut(&TypeRef)) {
|
fn go(type_ref: &TypeRef, f: &mut impl FnMut(&TypeRef)) {
|
||||||
f(type_ref);
|
f(type_ref);
|
||||||
match type_ref {
|
match type_ref {
|
||||||
TypeRef::Fn(types, _) => types.iter().for_each(|t| go(&t.1, f)),
|
TypeRef::Fn(params, _) => {
|
||||||
|
params.iter().for_each(|(_, param_type)| go(¶m_type, f))
|
||||||
|
}
|
||||||
TypeRef::Tuple(types) => types.iter().for_each(|t| go(t, f)),
|
TypeRef::Tuple(types) => types.iter().for_each(|t| go(t, f)),
|
||||||
TypeRef::RawPtr(type_ref, _)
|
TypeRef::RawPtr(type_ref, _)
|
||||||
| TypeRef::Reference(type_ref, ..)
|
| TypeRef::Reference(type_ref, ..)
|
||||||
|
@ -1103,9 +1103,10 @@ impl HirDisplay for TypeRef {
|
|||||||
write!(f, "{}: ", name)?;
|
write!(f, "{}: ", name)?;
|
||||||
param_type.hir_fmt(f)?;
|
param_type.hir_fmt(f)?;
|
||||||
}
|
}
|
||||||
None => write!(f, " : {:?}", param_type)?,
|
None => param_type.hir_fmt(f)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Last index contains the return type so we stop writing commas on the second-to-last index
|
||||||
if index != parameters.len() - 2 {
|
if index != parameters.len() - 2 {
|
||||||
write!(f, ", ")?;
|
write!(f, ", ")?;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ impl<'a> TyLoweringContext<'a> {
|
|||||||
TypeRef::Placeholder => TyKind::Error.intern(Interner),
|
TypeRef::Placeholder => TyKind::Error.intern(Interner),
|
||||||
TypeRef::Fn(params, is_varargs) => {
|
TypeRef::Fn(params, is_varargs) => {
|
||||||
let substs = self.with_shifted_in(DebruijnIndex::ONE, |ctx| {
|
let substs = self.with_shifted_in(DebruijnIndex::ONE, |ctx| {
|
||||||
Substitution::from_iter(Interner, params.iter().map(|tr| ctx.lower_ty(&tr.1)))
|
Substitution::from_iter(Interner, params.iter().map(|(_, tr)| ctx.lower_ty(tr)))
|
||||||
});
|
});
|
||||||
TyKind::Function(FnPointer {
|
TyKind::Function(FnPointer {
|
||||||
num_binders: 0, // FIXME lower `for<'a> fn()` correctly
|
num_binders: 0, // FIXME lower `for<'a> fn()` correctly
|
||||||
|
Loading…
Reference in New Issue
Block a user