Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice
This commit is contained in:
parent
2f7eb6dbc5
commit
a2fd41174f
9 changed files with 36 additions and 17 deletions
|
@ -489,11 +489,11 @@ impl workspace::Item for ProjectDiagnosticsEditor {
|
|||
}
|
||||
|
||||
fn is_dirty(&self, cx: &AppContext) -> bool {
|
||||
self.excerpts.read(cx).read(cx).is_dirty()
|
||||
self.excerpts.read(cx).is_dirty(cx)
|
||||
}
|
||||
|
||||
fn has_conflict(&self, cx: &AppContext) -> bool {
|
||||
self.excerpts.read(cx).read(cx).has_conflict()
|
||||
self.excerpts.read(cx).has_conflict(cx)
|
||||
}
|
||||
|
||||
fn can_save(&self, _: &AppContext) -> bool {
|
||||
|
|
|
@ -60,7 +60,7 @@ impl DiagnosticIndicator {
|
|||
let buffer = editor.buffer().read(cx);
|
||||
let cursor_position = editor.selections.newest::<usize>(cx).head();
|
||||
let new_diagnostic = buffer
|
||||
.read(cx)
|
||||
.snapshot(cx)
|
||||
.diagnostics_in_range::<_, usize>(cursor_position..cursor_position, false)
|
||||
.filter(|entry| !entry.range.is_empty())
|
||||
.min_by_key(|entry| (entry.diagnostic.severity, entry.range.len()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue