mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Use &str instread of Option<String>
This commit is contained in:
parent
fc70275fed
commit
e91bf0bba4
2 changed files with 5 additions and 5 deletions
|
@ -78,7 +78,7 @@ where
|
||||||
pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option<String> {
|
pub(crate) fn doc_text_for(nav: NavigationTarget) -> Option<String> {
|
||||||
match (nav.description(), nav.docs()) {
|
match (nav.description(), nav.docs()) {
|
||||||
(Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)),
|
(Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)),
|
||||||
(None, Some(docs)) => Some(docs),
|
(None, Some(docs)) => Some(docs.to_string()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,12 @@ impl NavigationTarget {
|
||||||
self.full_range
|
self.full_range
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn docs(&self) -> Option<String> {
|
pub fn docs(&self) -> Option<&str> {
|
||||||
self.docs.clone()
|
self.docs.as_ref().map(String::as_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn description(&self) -> Option<String> {
|
pub fn description(&self) -> Option<&str> {
|
||||||
self.description.clone()
|
self.description.as_ref().map(String::as_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A "most interesting" range withing the `full_range`.
|
/// A "most interesting" range withing the `full_range`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue