Skip to content

Commit

Permalink
avoid cloning the source code (#8556)
Browse files Browse the repository at this point in the history
### Description

avoid unnecessary clone of source code

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
sokra committed Jun 21, 2024
1 parent ec3580d commit 8fc19a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/turbopack-ecmascript/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ async fn parse_content(
let mut result = WrapFuture::new(
async {
let file_name = FileName::Custom(ident.to_string());
let fm = source_map.new_source_file(file_name.clone(), string.clone());
let fm = source_map.new_source_file(file_name.clone(), string);

let comments = SwcComments::default();

Expand Down Expand Up @@ -419,7 +419,7 @@ async fn parse_content(
} else {
None
};
let messages = Some(messages.unwrap_or_else(|| vec![string.into()]));
let messages = Some(messages.unwrap_or_else(|| vec![fm.src.clone().into()]));
return Ok(ParseResult::Unparseable { messages });
}

Expand Down

0 comments on commit 8fc19a2

Please sign in to comment.