Use try_global()
This commit is contained in:
parent
933fb87013
commit
b807e6fe80
10 changed files with 52 additions and 70 deletions
|
@ -275,11 +275,8 @@ pub struct SearchResult {
|
|||
|
||||
impl SemanticIndex {
|
||||
pub fn global(cx: &mut AppContext) -> Option<Model<SemanticIndex>> {
|
||||
if cx.has_global::<Model<Self>>() {
|
||||
Some(cx.global::<Model<SemanticIndex>>().clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
cx.try_global::<Model<Self>>()
|
||||
.map(|semantic_index| semantic_index.clone())
|
||||
}
|
||||
|
||||
pub fn authenticate(&mut self, cx: &mut AppContext) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue