Skip to content

Commit

Permalink
RcStr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jun 5, 2024
1 parent 3dcbdbb commit 9613e68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions crates/turbopack-ecmascript/src/references/external_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{fmt::Display, io::Write};

use anyhow::Result;
use serde::{Deserialize, Serialize};
use turbo_tasks::{trace::TraceRawVcs, TaskInput, Vc};
use turbo_tasks::{trace::TraceRawVcs, RcStr, TaskInput, Vc};
use turbo_tasks_fs::{glob::Glob, rope::RopeBuilder, FileContent, FileSystem, VirtualFileSystem};
use turbopack_core::{
asset::{Asset, AssetContent},
Expand All @@ -23,8 +23,8 @@ use crate::{
};

#[turbo_tasks::function]
fn layer() -> Vc<String> {
Vc::cell("external".to_string())
fn layer() -> Vc<RcStr> {
Vc::cell("external".into())
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize, TraceRawVcs, TaskInput)]
Expand All @@ -46,14 +46,14 @@ impl Display for CachedExternalType {

#[turbo_tasks::value]
pub struct CachedExternalModule {
pub request: String,
pub request: RcStr,
pub external_type: CachedExternalType,
}

#[turbo_tasks::value_impl]
impl CachedExternalModule {
#[turbo_tasks::function]
pub fn new(request: String, external_type: CachedExternalType) -> Vc<Self> {
pub fn new(request: RcStr, external_type: CachedExternalType) -> Vc<Self> {
Self::cell(CachedExternalModule {
request,
external_type,
Expand Down Expand Up @@ -99,12 +99,12 @@ impl CachedExternalModule {
impl Module for CachedExternalModule {
#[turbo_tasks::function]
fn ident(&self) -> Vc<AssetIdent> {
let fs = VirtualFileSystem::new_with_name("externals".to_string());
let fs = VirtualFileSystem::new_with_name("externals".into());

AssetIdent::from_path(fs.root())
.with_layer(layer())
.with_modifier(Vc::cell(self.request.clone()))
.with_modifier(Vc::cell(self.external_type.to_string()))
.with_modifier(Vc::cell(self.external_type.to_string().into()))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-tests/tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async fn run_test(prepared_test: Vc<PreparedTest>) -> Result<Vc<RunTestResult>>
.process(
Vc::upcast(jest_entry_source),
Value::new(ReferenceType::Internal(Vc::cell(indexmap! {
"TESTS".to_string() => test_asset,
"TESTS".into() => test_asset,
}))),
)
.module();
Expand Down

0 comments on commit 9613e68

Please sign in to comment.