From 0799288f0189c07907a30787e7d2f5f0bf960996 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 20 Feb 2021 20:43:04 +0100 Subject: Don't write trailing whitespace when formatting empty GenericPredicates --- crates/hir/src/code_model.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/hir/src') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 021e4ad31..b3218833d 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -28,7 +28,7 @@ use hir_expand::{ }; use hir_ty::{ autoderef, - display::{write_bounds_like_dyn_trait, HirDisplayError, HirFormatter}, + display::{write_bounds_like_dyn_trait_with_prefix, HirDisplayError, HirFormatter}, method_resolution, traits::{FnTrait, Solution, SolutionVariables}, ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate, @@ -1379,8 +1379,7 @@ impl HirDisplay for TypeParam { let substs = Substs::type_params(f.db, self.id.parent); let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::>(); if !(predicates.is_empty() || f.omit_verbose_types()) { - write!(f, ": ")?; - write_bounds_like_dyn_trait(&predicates, f)?; + write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; } Ok(()) } -- cgit v1.2.3