about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeroen Vannevel <jer_vannevel@outlook.com>2022-02-15 14:55:21 +0000
committerJeroen Vannevel <jer_vannevel@outlook.com>2022-02-15 14:55:21 +0000
commit0a80cc82b1220eddcfd00327f5debcbb7dce975c (patch)
treec18cd2f1390d26ce4a78fb444b056eb52c35ba33
parent3bba811e925e8eb5d53a58b7cb8a10fa29f71caa (diff)
downloadrust-0a80cc82b1220eddcfd00327f5debcbb7dce975c.tar.gz
rust-0a80cc82b1220eddcfd00327f5debcbb7dce975c.zip
cleaning
-rw-r--r--crates/hir_def/src/type_ref.rs4
-rw-r--r--crates/hir_ty/src/display.rs3
-rw-r--r--crates/hir_ty/src/lower.rs2
3 files changed, 6 insertions, 3 deletions
diff --git a/crates/hir_def/src/type_ref.rs b/crates/hir_def/src/type_ref.rs
index dcc43c1fada..01aca8f1de0 100644
--- a/crates/hir_def/src/type_ref.rs
+++ b/crates/hir_def/src/type_ref.rs
@@ -241,7 +241,9 @@ impl TypeRef {
         fn go(type_ref: &TypeRef, f: &mut impl FnMut(&TypeRef)) {
             f(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(&param_type, f))
+                }
                 TypeRef::Tuple(types) => types.iter().for_each(|t| go(t, f)),
                 TypeRef::RawPtr(type_ref, _)
                 | TypeRef::Reference(type_ref, ..)
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 4b077c2c8af..377821b3761 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -1103,9 +1103,10 @@ impl HirDisplay for TypeRef {
                             write!(f, "{}: ", name)?;
                             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 {
                         write!(f, ", ")?;
                     }
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 4873693e8c7..a140dd4057c 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -201,7 +201,7 @@ impl<'a> TyLoweringContext<'a> {
             TypeRef::Placeholder => TyKind::Error.intern(Interner),
             TypeRef::Fn(params, is_varargs) => {
                 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 {
                     num_binders: 0, // FIXME lower `for<'a> fn()` correctly