aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-02-20 19:43:04 +0000
committerLukas Wirth <[email protected]>2021-02-20 19:43:04 +0000
commit0799288f0189c07907a30787e7d2f5f0bf960996 (patch)
treef88d886853bd27a397eef1c73e4b5fcf6ae75d65 /crates/hir/src
parent9e5192d917e998d78fd25c4013eb8117f7401068 (diff)
Don't write trailing whitespace when formatting empty GenericPredicates
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/code_model.rs5
1 files changed, 2 insertions, 3 deletions
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::{
28}; 28};
29use hir_ty::{ 29use hir_ty::{
30 autoderef, 30 autoderef,
31 display::{write_bounds_like_dyn_trait, HirDisplayError, HirFormatter}, 31 display::{write_bounds_like_dyn_trait_with_prefix, HirDisplayError, HirFormatter},
32 method_resolution, 32 method_resolution,
33 traits::{FnTrait, Solution, SolutionVariables}, 33 traits::{FnTrait, Solution, SolutionVariables},
34 ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate, 34 ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate,
@@ -1379,8 +1379,7 @@ impl HirDisplay for TypeParam {
1379 let substs = Substs::type_params(f.db, self.id.parent); 1379 let substs = Substs::type_params(f.db, self.id.parent);
1380 let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); 1380 let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>();
1381 if !(predicates.is_empty() || f.omit_verbose_types()) { 1381 if !(predicates.is_empty() || f.omit_verbose_types()) {
1382 write!(f, ": ")?; 1382 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?;
1383 write_bounds_like_dyn_trait(&predicates, f)?;
1384 } 1383 }
1385 Ok(()) 1384 Ok(())
1386 } 1385 }