diff options
author | Aleksey Kladov <[email protected]> | 2019-06-08 12:16:05 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-06-08 12:16:05 +0100 |
commit | 33026c654e3a667e25ea27004c22be138ed83d33 (patch) | |
tree | 5057b8fe11d8722cc9f7ac6f148851069730e2b7 /crates/ra_hir | |
parent | 5dc27898959d2330b0822d95a9ee2488e687895a (diff) |
make Docs handing more ideomatic
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir/src/docs.rs | 10 |
2 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 59d7d589a..861d6aefe 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -12,7 +12,6 @@ use crate::{ | |||
12 | ty::{TraitRef, InferenceResult, primitive::{IntTy, FloatTy, Signedness, IntBitness, FloatBitness}}, | 12 | ty::{TraitRef, InferenceResult, primitive::{IntTy, FloatTy, Signedness, IntBitness, FloatBitness}}, |
13 | adt::{EnumVariantId, StructFieldId, VariantDef}, | 13 | adt::{EnumVariantId, StructFieldId, VariantDef}, |
14 | generics::HasGenericParams, | 14 | generics::HasGenericParams, |
15 | docs::{Documentation, Docs, docs_from_ast}, | ||
16 | ids::{FunctionId, StructId, EnumId, AstItemDef, ConstId, StaticId, TraitId, TypeAliasId, MacroDefId}, | 15 | ids::{FunctionId, StructId, EnumId, AstItemDef, ConstId, StaticId, TraitId, TypeAliasId, MacroDefId}, |
17 | impl_block::ImplBlock, | 16 | impl_block::ImplBlock, |
18 | resolve::Resolver, | 17 | resolve::Resolver, |
diff --git a/crates/ra_hir/src/docs.rs b/crates/ra_hir/src/docs.rs index c2279fe95..38c0922eb 100644 --- a/crates/ra_hir/src/docs.rs +++ b/crates/ra_hir/src/docs.rs | |||
@@ -1,24 +1,24 @@ | |||
1 | use ra_syntax::ast; | 1 | use ra_syntax::ast; |
2 | 2 | ||
3 | use crate::{HirDatabase, Module, StructField, Struct, Enum, EnumVariant, Static, Const, Function, Union}; | 3 | use crate::{HirDatabase, Module, StructField, Struct, Enum, EnumVariant, Static, Const, Function, Union, Trait, TypeAlias, FieldSource}; |
4 | 4 | ||
5 | /// Holds documentation | 5 | /// Holds documentation |
6 | #[derive(Debug, Clone)] | 6 | #[derive(Debug, Clone)] |
7 | pub struct Documentation(String); | 7 | pub struct Documentation(String); |
8 | 8 | ||
9 | impl Documentation { | 9 | impl Documentation { |
10 | pub fn new(s: &str) -> Self { | 10 | fn new(s: &str) -> Documentation { |
11 | Self(s.into()) | 11 | Documentation(s.into()) |
12 | } | 12 | } |
13 | 13 | ||
14 | pub fn contents(&self) -> &str { | 14 | pub fn as_str(&self) -> &str { |
15 | &self.0 | 15 | &self.0 |
16 | } | 16 | } |
17 | } | 17 | } |
18 | 18 | ||
19 | impl Into<String> for Documentation { | 19 | impl Into<String> for Documentation { |
20 | fn into(self) -> String { | 20 | fn into(self) -> String { |
21 | self.contents().into() | 21 | self.0.clone() |
22 | } | 22 | } |
23 | } | 23 | } |
24 | 24 | ||