Skip to content

Commit caba076

Browse files
committed
Remove type alias, avoid clone()
1 parent 294f569 commit caba076

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

crates/next-custom-transforms/src/transforms/server_actions.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ enum ServerActionsErrorKind {
136136
},
137137
}
138138

139-
pub type OrderedAtomMap = BTreeMap<Atom, Atom>;
140-
141139
#[tracing::instrument(level = tracing::Level::TRACE, skip_all)]
142140
pub fn server_actions<C: Comments>(
143141
file_name: &FileName,
@@ -196,7 +194,7 @@ pub fn server_actions<C: Comments>(
196194
/// Serializes the Server References into a magic comment prefixed by
197195
/// `__next_internal_action_entry_do_not_use__`.
198196
fn generate_server_references_comment(
199-
export_names_ordered_by_reference_id: &OrderedAtomMap,
197+
export_names_ordered_by_reference_id: &BTreeMap<&Atom, &Atom>,
200198
entry_path_query: Option<(&str, &str)>,
201199
) -> String {
202200
format!(
@@ -2110,11 +2108,11 @@ impl<C: Comments> VisitMut for ServerActions<C> {
21102108
if self.has_action || self.has_cache {
21112109
// Flip the map and convert it to a BTreeMap for deterministic
21122110
// ordering in the server references comment.
2113-
let export_names_ordered_by_reference_id: OrderedAtomMap = self
2111+
let export_names_ordered_by_reference_id = self
21142112
.reference_ids_by_export_name
21152113
.iter()
2116-
.map(|(export_name, reference_id)| (reference_id.clone(), export_name.clone()))
2117-
.collect();
2114+
.map(|(export_name, reference_id)| (reference_id, export_name))
2115+
.collect::<BTreeMap<_, _>>();
21182116

21192117
if self.config.is_react_server_layer {
21202118
// Prepend a special comment to the top of the file.
@@ -2190,7 +2188,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
21902188
span: DUMMY_SP,
21912189
kind: CommentKind::Block,
21922190
text: generate_server_references_comment(
2193-
&std::iter::once((ref_id, export)).collect(),
2191+
&std::iter::once((&ref_id, &export)).collect(),
21942192
Some((
21952193
&self.file_name,
21962194
self.file_query.as_ref().map_or("", |v| v),

0 commit comments

Comments
 (0)