diff options
Diffstat (limited to 'crates/hir/src/display.rs')
-rw-r--r-- | crates/hir/src/display.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index ab04c55bc..559ea31a0 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs | |||
@@ -20,22 +20,21 @@ impl HirDisplay for Function { | |||
20 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { | 20 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { |
21 | let data = f.db.function_data(self.id); | 21 | let data = f.db.function_data(self.id); |
22 | write_visibility(self.module(f.db).id, self.visibility(f.db), f)?; | 22 | write_visibility(self.module(f.db).id, self.visibility(f.db), f)?; |
23 | let qual = &data.qualifier; | 23 | if data.is_default() { |
24 | if qual.is_default { | ||
25 | write!(f, "default ")?; | 24 | write!(f, "default ")?; |
26 | } | 25 | } |
27 | if qual.is_const { | 26 | if data.is_const() { |
28 | write!(f, "const ")?; | 27 | write!(f, "const ")?; |
29 | } | 28 | } |
30 | if qual.is_async { | 29 | if data.is_async() { |
31 | write!(f, "async ")?; | 30 | write!(f, "async ")?; |
32 | } | 31 | } |
33 | if qual.is_unsafe { | 32 | if data.is_unsafe() { |
34 | write!(f, "unsafe ")?; | 33 | write!(f, "unsafe ")?; |
35 | } | 34 | } |
36 | if let Some(abi) = &qual.abi { | 35 | if let Some(abi) = &data.abi { |
37 | // FIXME: String escape? | 36 | // FIXME: String escape? |
38 | write!(f, "extern \"{}\" ", abi)?; | 37 | write!(f, "extern \"{}\" ", &**abi)?; |
39 | } | 38 | } |
40 | write!(f, "fn {}", data.name)?; | 39 | write!(f, "fn {}", data.name)?; |
41 | 40 | ||
@@ -68,7 +67,7 @@ impl HirDisplay for Function { | |||
68 | write!(f, ", ")?; | 67 | write!(f, ", ")?; |
69 | } else { | 68 | } else { |
70 | first = false; | 69 | first = false; |
71 | if data.has_self_param { | 70 | if data.has_self_param() { |
72 | write_self_param(type_ref, f)?; | 71 | write_self_param(type_ref, f)?; |
73 | continue; | 72 | continue; |
74 | } | 73 | } |
@@ -88,7 +87,7 @@ impl HirDisplay for Function { | |||
88 | // `FunctionData::ret_type` will be `::core::future::Future<Output = ...>` for async fns. | 87 | // `FunctionData::ret_type` will be `::core::future::Future<Output = ...>` for async fns. |
89 | // Use ugly pattern match to strip the Future trait. | 88 | // Use ugly pattern match to strip the Future trait. |
90 | // Better way? | 89 | // Better way? |
91 | let ret_type = if !qual.is_async { | 90 | let ret_type = if !data.is_async() { |
92 | &data.ret_type | 91 | &data.ret_type |
93 | } else { | 92 | } else { |
94 | match &*data.ret_type { | 93 | match &*data.ret_type { |