aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-08 12:16:05 +0100
committerAleksey Kladov <[email protected]>2019-06-08 12:16:05 +0100
commit33026c654e3a667e25ea27004c22be138ed83d33 (patch)
tree5057b8fe11d8722cc9f7ac6f148851069730e2b7 /crates/ra_hir
parent5dc27898959d2330b0822d95a9ee2488e687895a (diff)
make Docs handing more ideomatic
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs1
-rw-r--r--crates/ra_hir/src/docs.rs10
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 @@
1use ra_syntax::ast; 1use ra_syntax::ast;
2 2
3use crate::{HirDatabase, Module, StructField, Struct, Enum, EnumVariant, Static, Const, Function, Union}; 3use 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)]
7pub struct Documentation(String); 7pub struct Documentation(String);
8 8
9impl Documentation { 9impl 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
19impl Into<String> for Documentation { 19impl 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