diff options
author | Florian Diebold <[email protected]> | 2020-04-13 13:39:44 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-04-13 13:46:03 +0100 |
commit | 2e7b88b5256bd6c51226b63b93481a77ac901e14 (patch) | |
tree | 598e62fba5a307149a4212232c9d5fb5c188b761 /crates/ra_hir_ty/src | |
parent | 7886513f89795e06eef258e0c54dbd1224c98317 (diff) |
Nicer display of projections in Chalk logs
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/tls.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs index 0a8932dae..fa8e4d1ad 100644 --- a/crates/ra_hir_ty/src/traits/chalk/tls.rs +++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | use std::fmt; | 2 | use std::fmt; |
3 | 3 | ||
4 | use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName}; | 4 | use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName}; |
5 | use itertools::Itertools; | ||
5 | 6 | ||
6 | use super::{from_chalk, Interner}; | 7 | use super::{from_chalk, Interner}; |
7 | use crate::{db::HirDatabase, CallableDef, TypeCtor}; | 8 | use crate::{db::HirDatabase, CallableDef, TypeCtor}; |
@@ -133,14 +134,15 @@ impl DebugContext<'_> { | |||
133 | }; | 134 | }; |
134 | let trait_data = self.0.trait_data(trait_); | 135 | let trait_data = self.0.trait_data(trait_); |
135 | let params = alias.substitution.parameters(&Interner); | 136 | let params = alias.substitution.parameters(&Interner); |
136 | write!( | 137 | write!(fmt, "<{:?} as {}", ¶ms[0], trait_data.name,)?; |
137 | fmt, | 138 | if params.len() > 1 { |
138 | "<{:?} as {}<{:?}>>::{}", | 139 | write!( |
139 | ¶ms[0], | 140 | fmt, |
140 | trait_data.name, | 141 | "<{}>", |
141 | ¶ms[1..], | 142 | ¶ms[1..].iter().format_with(", ", |x, f| f(&format_args!("{:?}", x))), |
142 | type_alias_data.name | 143 | )?; |
143 | ) | 144 | } |
145 | write!(fmt, ">::{}", type_alias_data.name) | ||
144 | } | 146 | } |
145 | 147 | ||
146 | pub fn debug_ty( | 148 | pub fn debug_ty( |