Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice

This commit is contained in:
Keith Simmons 2022-05-13 16:58:30 -07:00
parent 2f7eb6dbc5
commit a2fd41174f
9 changed files with 36 additions and 17 deletions

View file

@ -39,9 +39,7 @@ impl Breadcrumbs {
let editor = self.editor.as_ref()?.read(cx);
let cursor = editor.selections.newest_anchor().head();
let multibuffer = &editor.buffer().read(cx);
let (buffer_id, symbols) = multibuffer
.read(cx)
.symbols_containing(cursor, Some(theme))?;
let (buffer_id, symbols) = multibuffer.symbols_containing(cursor, Some(theme), cx)?;
let buffer = multibuffer.buffer(buffer_id)?;
Some((buffer, symbols))
}