Skip to content

Commit 853432f

Browse files
committed
perf: remove Rc
1 parent 30c0657 commit 853432f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/helpers.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use rustc_hash::FxHashMap as HashMap;
33
use std::{
44
borrow::{BorrowMut, Cow},
55
cell::{OnceCell, RefCell},
6-
rc::Rc,
76
};
87

98
use crate::{
@@ -15,7 +14,7 @@ use crate::{
1514

1615
// Adding this type because sourceContentLine not happy
1716
type InnerSourceContentLine<'a> =
18-
RefCell<HashMap<i64, Option<Rc<Vec<WithIndices<&'a str>>>>>>;
17+
RefCell<HashMap<i64, Option<Vec<WithIndices<&'a str>>>>>;
1918

2019
pub fn get_map<'a, S: StreamChunks<'a>>(
2120
stream: &'a S,
@@ -1046,11 +1045,11 @@ pub fn stream_chunks_of_combined_source_map<'a>(
10461045
original_source_lines = if let Some(Some(original_source)) =
10471046
inner_source_contents.get(&inner_source_index)
10481047
{
1049-
Some(Rc::new(
1048+
Some(
10501049
split_into_lines(original_source)
10511050
.map(WithIndices::new)
10521051
.collect(),
1053-
))
1052+
)
10541053
} else {
10551054
None
10561055
};
@@ -1148,12 +1147,10 @@ pub fn stream_chunks_of_combined_source_map<'a>(
11481147
.and_then(|original_source| {
11491148
original_source.as_ref().map(|s| {
11501149
let lines = split_into_lines(s);
1151-
Rc::new(
1152-
lines
1153-
.into_iter()
1154-
.map(WithIndices::new)
1155-
.collect::<Vec<_>>(),
1156-
)
1150+
lines
1151+
.into_iter()
1152+
.map(WithIndices::new)
1153+
.collect::<Vec<_>>()
11571154
})
11581155
});
11591156
inner_source_content_lines

0 commit comments

Comments
 (0)