mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-12-27 16:07:46 +00:00
Merge pull request #20977 from chirizxc/patch-1
Move safe computation out of unsafe block
This commit is contained in:
commit
3668c75171
@ -62,8 +62,8 @@ impl LineEndings {
|
||||
|
||||
// Account for removed `\r`.
|
||||
// After `set_len`, `buf` is guaranteed to contain utf-8 again.
|
||||
let new_len = buf.len() - gap_len;
|
||||
let src = unsafe {
|
||||
let new_len = buf.len() - gap_len;
|
||||
buf.set_len(new_len);
|
||||
String::from_utf8_unchecked(buf)
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user