Move the save and save_as code paths close together

This commit is contained in:
Max Brunsfeld 2023-02-17 16:53:18 -08:00
parent de6eb00e2b
commit 3a7cfc3901
7 changed files with 125 additions and 169 deletions

View file

@ -1064,15 +1064,16 @@ async fn randomly_query_and_mutate_buffers(
}
}
30..=39 if buffer.read_with(cx, |buffer, _| buffer.is_dirty()) => {
let (requested_version, save) = buffer.update(cx, |buffer, cx| {
let requested_version = buffer.update(cx, |buffer, cx| {
log::info!(
"{}: saving buffer {} ({:?})",
client.username,
buffer.remote_id(),
buffer.file().unwrap().full_path(cx)
);
(buffer.version(), buffer.save(cx))
buffer.version()
});
let save = cx.update(|cx| Project::save_buffer(buffer, cx));
let save = cx.background().spawn(async move {
let (saved_version, _, _) = save
.await