In emacs >= 26.2, use replace-buffer-contents after formatting
In emacs >= 26.2, use replace-buffer-contents after formatting

This saves the position and the markers in the buffer, so there is no
need to save positions of direct and indirect buffers and windows.
This also plays better with e.g. grep, as otherwise all grep markers
would be destroyed when replacing the contents of the buffer with
copy-to-buffer.

While replace-buffer-contents was added in Emacs 26.1, it was broken
for non-ASCII contents and would corrupt the buffer contents. This was
fixed in 26.2, so we require version 26.2 for this.

rust-lang/rust-mode,rust-lang/rust-mode