aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/display.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-03 19:22:59 +0100
committerFlorian Diebold <[email protected]>2021-04-04 12:16:38 +0100
commitb0fe3d929f6f8764f371970b9f9ca9e7c415dafd (patch)
tree384bd17e3428b591f1c82d1b061ceecee529c044 /crates/hir_ty/src/display.rs
parentb15152c430237d6850ec709ac75aab269c4b7dee (diff)
Add TyBuilder::unit() and TyExt::is_unit()
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r--crates/hir_ty/src/display.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 97f1092c6..eb82e1a11 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -19,7 +19,8 @@ use crate::{
19 db::HirDatabase, from_assoc_type_id, from_foreign_def_id, from_placeholder_idx, primitive, 19 db::HirDatabase, from_assoc_type_id, from_foreign_def_id, from_placeholder_idx, primitive,
20 to_assoc_type_id, traits::chalk::from_chalk, utils::generics, AdtId, AliasEq, AliasTy, 20 to_assoc_type_id, traits::chalk::from_chalk, utils::generics, AdtId, AliasEq, AliasTy,
21 CallableDefId, CallableSig, DomainGoal, GenericArg, ImplTraitId, Interner, Lifetime, OpaqueTy, 21 CallableDefId, CallableSig, DomainGoal, GenericArg, ImplTraitId, Interner, Lifetime, OpaqueTy,
22 ProjectionTy, QuantifiedWhereClause, Scalar, Substitution, TraitRef, Ty, TyKind, WhereClause, 22 ProjectionTy, QuantifiedWhereClause, Scalar, Substitution, TraitRef, Ty, TyExt, TyKind,
23 WhereClause,
23}; 24};
24 25
25pub struct HirFormatter<'a> { 26pub struct HirFormatter<'a> {
@@ -423,7 +424,7 @@ impl HirDisplay for Ty {
423 f.write_joined(sig.params(), ", ")?; 424 f.write_joined(sig.params(), ", ")?;
424 write!(f, ")")?; 425 write!(f, ")")?;
425 let ret = sig.ret(); 426 let ret = sig.ret();
426 if *ret != Ty::unit() { 427 if !ret.is_unit() {
427 let ret_display = ret.into_displayable( 428 let ret_display = ret.into_displayable(
428 f.db, 429 f.db,
429 f.max_size, 430 f.max_size,
@@ -663,7 +664,7 @@ impl HirDisplay for CallableSig {
663 } 664 }
664 write!(f, ")")?; 665 write!(f, ")")?;
665 let ret = self.ret(); 666 let ret = self.ret();
666 if *ret != Ty::unit() { 667 if !ret.is_unit() {
667 let ret_display = 668 let ret_display =
668 ret.into_displayable(f.db, f.max_size, f.omit_verbose_types, f.display_target); 669 ret.into_displayable(f.db, f.max_size, f.omit_verbose_types, f.display_target);
669 write!(f, " -> {}", ret_display)?; 670 write!(f, " -> {}", ret_display)?;