mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Convert directly into an Arc<str>
This commit is contained in:
parent
4aab2d5cb4
commit
9df73c6cb0
1 changed files with 4 additions and 4 deletions
|
@ -149,15 +149,15 @@ impl ChangeFixture {
|
||||||
for entry in fixture {
|
for entry in fixture {
|
||||||
let text = if entry.text.contains(CURSOR_MARKER) {
|
let text = if entry.text.contains(CURSOR_MARKER) {
|
||||||
if entry.text.contains(ESCAPED_CURSOR_MARKER) {
|
if entry.text.contains(ESCAPED_CURSOR_MARKER) {
|
||||||
entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER)
|
entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER).into()
|
||||||
} else {
|
} else {
|
||||||
let (range_or_offset, text) = extract_range_or_offset(&entry.text);
|
let (range_or_offset, text) = extract_range_or_offset(&entry.text);
|
||||||
assert!(file_position.is_none());
|
assert!(file_position.is_none());
|
||||||
file_position = Some((file_id, range_or_offset));
|
file_position = Some((file_id, range_or_offset));
|
||||||
text
|
text.into()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
entry.text.clone()
|
entry.text.as_str().into()
|
||||||
};
|
};
|
||||||
|
|
||||||
let meta = FileMeta::from_fixture(entry, current_source_root_kind);
|
let meta = FileMeta::from_fixture(entry, current_source_root_kind);
|
||||||
|
@ -206,7 +206,7 @@ impl ChangeFixture {
|
||||||
default_env.extend(meta.env.iter().map(|(x, y)| (x.to_owned(), y.to_owned())));
|
default_env.extend(meta.env.iter().map(|(x, y)| (x.to_owned(), y.to_owned())));
|
||||||
}
|
}
|
||||||
|
|
||||||
source_change.change_file(file_id, Some(text.into()));
|
source_change.change_file(file_id, Some(text));
|
||||||
let path = VfsPath::new_virtual_path(meta.path);
|
let path = VfsPath::new_virtual_path(meta.path);
|
||||||
file_set.insert(file_id, path);
|
file_set.insert(file_id, path);
|
||||||
files.push(file_id);
|
files.push(file_id);
|
||||||
|
|
Loading…
Reference in a new issue