From 7072f59fc61b8b487f301df1fe5eefbcc84672aa Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 1 Mar 2021 19:30:34 +0100 Subject: Use chalk_ir::Mutability --- crates/hir_ty/src/display.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty/src/display.rs') diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index f3a4333cb..d4a8b48e6 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -8,6 +8,7 @@ use crate::{ TraitRef, Ty, }; use arrayvec::ArrayVec; +use chalk_ir::Mutability; use hir_def::{ db::DefDatabase, find_path, generics::TypeParamProvenance, item_scope::ItemInNs, AdtId, AssocContainerId, HasModule, Lookup, ModuleId, TraitId, @@ -291,9 +292,23 @@ impl HirDisplay for Ty { t.into_displayable(f.db, f.max_size, f.omit_verbose_types, f.display_target); if matches!(self, Ty::Raw(..)) { - write!(f, "*{}", m.as_keyword_for_ptr())?; + write!( + f, + "*{}", + match m { + Mutability::Not => "const ", + Mutability::Mut => "mut ", + } + )?; } else { - write!(f, "&{}", m.as_keyword_for_ref())?; + write!( + f, + "&{}", + match m { + Mutability::Not => "", + Mutability::Mut => "mut ", + } + )?; } let datas; -- cgit v1.2.3