aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-06-09 20:37:34 +0100
committerEdwin Cheng <[email protected]>2019-06-09 20:37:34 +0100
commite91bf0bba4d0611af81b17430a975656e96006c6 (patch)
tree26c0c7252fe36f8b431d55e054ba60c1aa8231b1
parentfc70275fedc4edd7c53003d93df8826046591951 (diff)
Use &str instread of Option<String>
-rw-r--r--crates/ra_ide_api/src/display.rs2
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/display.rs b/crates/ra_ide_api/src/display.rs
index 7a8734a75..f11af0a0b 100644
--- a/crates/ra_ide_api/src/display.rs
+++ b/crates/ra_ide_api/src/display.rs
@@ -78,7 +78,7 @@ where
78pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option<String> { 78pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option<String> {
79 match (nav.description(), nav.docs()) { 79 match (nav.description(), nav.docs()) {
80 (Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)), 80 (Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)),
81 (None, Some(docs)) => Some(docs), 81 (None, Some(docs)) => Some(docs.to_string()),
82 _ => None, 82 _ => None,
83 } 83 }
84} 84}
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index 9b17d6adc..80726efbb 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -54,12 +54,12 @@ impl NavigationTarget {
54 self.full_range 54 self.full_range
55 } 55 }
56 56
57 pub fn docs(&self) -> Option<String> { 57 pub fn docs(&self) -> Option<&str> {
58 self.docs.clone() 58 self.docs.as_ref().map(String::as_str)
59 } 59 }
60 60
61 pub fn description(&self) -> Option<String> { 61 pub fn description(&self) -> Option<&str> {
62 self.description.clone() 62 self.description.as_ref().map(String::as_str)
63 } 63 }
64 64
65 /// A "most interesting" range withing the `full_range`. 65 /// A "most interesting" range withing the `full_range`.