aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-09 10:29:11 +0100
committerGitHub <[email protected]>2020-05-09 10:29:11 +0100
commit25e37e2c93ba91a8956fdff8bbe9701c623d386f (patch)
treec8c3d772e9ad5a71f7ea911b4c82a2f373211143 /crates/ra_hir/src/code_model.rs
parentd7a0b0ff913d717fa6e7c5a1db02a30316760a75 (diff)
parent64e6b8200bfceea92b0dcaab3e533a9152994e78 (diff)
Merge #4175
4175: Introduce HirDisplay method for rendering source code & use it in add_function assist r=flodiebold a=TimoFreiberg Next feature for #3639. So far the only change in the new `HirDisplay` method is that paths are qualified, but more changes will be necessary (omitting the function name from function types, returning an error instead of printing `"{unknown}"`, probably more). Is that approach okay? Co-authored-by: Timo Freiberg <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r--crates/ra_hir/src/code_model.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 5f480c304..be18c845c 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -22,8 +22,11 @@ use hir_expand::{
22 MacroDefId, MacroDefKind, 22 MacroDefId, MacroDefKind,
23}; 23};
24use hir_ty::{ 24use hir_ty::{
25 autoderef, display::HirFormatter, expr::ExprValidator, method_resolution, ApplicationTy, 25 autoderef,
26 Canonical, InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor, 26 display::{HirDisplayError, HirFormatter},
27 expr::ExprValidator,
28 method_resolution, ApplicationTy, Canonical, InEnvironment, Substs, TraitEnvironment, Ty,
29 TyDefId, TypeCtor,
27}; 30};
28use ra_db::{CrateId, CrateName, Edition, FileId}; 31use ra_db::{CrateId, CrateName, Edition, FileId};
29use ra_prof::profile; 32use ra_prof::profile;
@@ -1319,7 +1322,7 @@ impl Type {
1319} 1322}
1320 1323
1321impl HirDisplay for Type { 1324impl HirDisplay for Type {
1322 fn hir_fmt(&self, f: &mut HirFormatter) -> std::fmt::Result { 1325 fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
1323 self.ty.value.hir_fmt(f) 1326 self.ty.value.hir_fmt(f)
1324 } 1327 }
1325} 1328}