Skip to content
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ exclude = ["crates/next-error-code-swc-plugin"]
[workspace.lints.clippy]
too_many_arguments = "allow"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rust_analyzer)'] }

# This crate is particularly sensitive to compiler optimizations
[profile.dev.package.turbo-persistence]
opt-level = 1
Expand Down
9 changes: 4 additions & 5 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ struct ConflictIssue {
path: ResolvedVc<FileSystemPath>,
title: ResolvedVc<StyledString>,
description: ResolvedVc<StyledString>,
severity: ResolvedVc<IssueSeverity>,
severity: IssueSeverity,
}

#[turbo_tasks::value_impl]
Expand All @@ -608,9 +608,8 @@ impl Issue for ConflictIssue {
IssueStage::AppStructure.cell()
}

#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
*self.severity
fn severity(&self) -> IssueSeverity {
self.severity
}

#[turbo_tasks::function]
Expand Down Expand Up @@ -1209,7 +1208,7 @@ impl Project {
.into(),
)
.resolved_cell(),
severity: IssueSeverity::Error.resolved_cell(),
severity: IssueSeverity::Error,
}
.resolved_cell()
.emit();
Expand Down
23 changes: 11 additions & 12 deletions crates/next-core/src/app_segment_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use swc_core::{
common::{GLOBALS, Span, Spanned, source_map::SmallPos},
ecma::ast::{Decl, Expr, FnExpr, Ident, Program},
};
use turbo_rcstr::RcStr;
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{
NonLocalValue, ResolvedVc, TryJoinIterExt, ValueDefault, Vc, trace::TraceRawVcs,
util::WrapFuture,
Expand Down Expand Up @@ -199,15 +199,16 @@ impl NextSegmentConfigParsingIssue {

#[turbo_tasks::value_impl]
impl Issue for NextSegmentConfigParsingIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
IssueSeverity::Warning.into()
fn severity(&self) -> IssueSeverity {
IssueSeverity::Warning
}

#[turbo_tasks::function]
fn title(&self) -> Vc<StyledString> {
StyledString::Text("Next.js can't recognize the exported `config` field in route".into())
.cell()
StyledString::Text(rcstr!(
"Next.js can't recognize the exported `config` field in route"
))
.cell()
}

#[turbo_tasks::function]
Expand All @@ -223,11 +224,10 @@ impl Issue for NextSegmentConfigParsingIssue {
#[turbo_tasks::function]
fn description(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(
StyledString::Text(
StyledString::Text(rcstr!(
"The exported configuration object in a source file needs to have a very specific \
format from which some properties can be statically parsed at compiled-time."
.into(),
)
))
.resolved_cell(),
))
}
Expand All @@ -239,10 +239,9 @@ impl Issue for NextSegmentConfigParsingIssue {

#[turbo_tasks::function]
fn documentation_link(&self) -> Vc<RcStr> {
Vc::cell(
Vc::cell(rcstr!(
"https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config"
.into(),
)
))
}

#[turbo_tasks::function]
Expand Down
9 changes: 4 additions & 5 deletions crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ fn conflict_issue(
.into(),
)
.resolved_cell(),
severity: IssueSeverity::Error.resolved_cell(),
severity: IssueSeverity::Error,
}
.resolved_cell()
.emit();
Expand Down Expand Up @@ -1529,16 +1529,15 @@ pub async fn get_global_metadata(

#[turbo_tasks::value(shared)]
struct DirectoryTreeIssue {
pub severity: ResolvedVc<IssueSeverity>,
pub severity: IssueSeverity,
pub app_dir: ResolvedVc<FileSystemPath>,
pub message: ResolvedVc<StyledString>,
}

#[turbo_tasks::value_impl]
impl Issue for DirectoryTreeIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
*self.severity
fn severity(&self) -> IssueSeverity {
self.severity
}

#[turbo_tasks::function]
Expand Down
5 changes: 2 additions & 3 deletions crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1653,9 +1653,8 @@ struct OutdatedConfigIssue {

#[turbo_tasks::value_impl]
impl Issue for OutdatedConfigIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
IssueSeverity::Error.into()
fn severity(&self) -> IssueSeverity {
IssueSeverity::Error
}

#[turbo_tasks::function]
Expand Down
2 changes: 1 addition & 1 deletion crates/next-core/src/next_font/google/font_fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub(super) async fn get_font_fallback(
"Skipping generating a fallback font."
))
.resolved_cell(),
severity: IssueSeverity::Warning.resolved_cell(),
severity: IssueSeverity::Warning,
}
.resolved_cell()
.emit();
Expand Down
14 changes: 7 additions & 7 deletions crates/next-core/src/next_font/google/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ impl NextFontGoogleCssModuleReplacer {
NextFontIssue {
path: css_virtual_path.to_resolved().await?,
title: StyledString::Line(vec![
StyledString::Code("next/font:".into()),
StyledString::Text(" error:".into()),
StyledString::Code(rcstr!("next/font:")),
StyledString::Text(rcstr!(" error:")),
])
.resolved_cell(),
description: StyledString::Text(
Expand All @@ -260,7 +260,7 @@ impl NextFontGoogleCssModuleReplacer {
.into(),
)
.resolved_cell(),
severity: IssueSeverity::Error.resolved_cell(),
severity: IssueSeverity::Error,
}
.resolved_cell()
.emit();
Expand All @@ -272,8 +272,8 @@ impl NextFontGoogleCssModuleReplacer {
NextFontIssue {
path: css_virtual_path.to_resolved().await?,
title: StyledString::Line(vec![
StyledString::Code("next/font:".into()),
StyledString::Text(" warning:".into()),
StyledString::Code(rcstr!("next/font:")),
StyledString::Text(rcstr!(" warning:")),
])
.resolved_cell(),
description: StyledString::Text(
Expand All @@ -285,7 +285,7 @@ impl NextFontGoogleCssModuleReplacer {
.into(),
)
.resolved_cell(),
severity: IssueSeverity::Warning.resolved_cell(),
severity: IssueSeverity::Warning,
}
.resolved_cell()
.emit();
Expand Down Expand Up @@ -663,7 +663,7 @@ async fn fetch_from_google_fonts(
Ok(match *result {
Ok(r) => Some(*r.await?.body),
Err(err) => {
err.to_issue(IssueSeverity::Warning.into(), virtual_path)
err.to_issue(IssueSeverity::Warning, virtual_path)
.to_resolved()
.await?
.emit();
Expand Down
7 changes: 3 additions & 4 deletions crates/next-core/src/next_font/issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub(crate) struct NextFontIssue {
pub(crate) path: ResolvedVc<FileSystemPath>,
pub(crate) title: ResolvedVc<StyledString>,
pub(crate) description: ResolvedVc<StyledString>,
pub(crate) severity: ResolvedVc<IssueSeverity>,
pub(crate) severity: IssueSeverity,
}

#[turbo_tasks::value_impl]
Expand All @@ -17,9 +17,8 @@ impl Issue for NextFontIssue {
IssueStage::CodeGen.into()
}

#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
*self.severity
fn severity(&self) -> IssueSeverity {
self.severity
}

#[turbo_tasks::function]
Expand Down
5 changes: 2 additions & 3 deletions crates/next-core/src/next_font/local/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,8 @@ struct FontResolvingIssue {

#[turbo_tasks::value_impl]
impl Issue for FontResolvingIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
IssueSeverity::Error.cell()
fn severity(&self) -> IssueSeverity {
IssueSeverity::Error
}

#[turbo_tasks::function]
Expand Down
2 changes: 1 addition & 1 deletion crates/next-core/src/next_font/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub(crate) async fn can_use_next_font(
StyledString::Code(request.path),
])
.resolved_cell(),
severity: IssueSeverity::Error.resolved_cell(),
severity: IssueSeverity::Error,
}
.resolved_cell()
.emit();
Expand Down
3 changes: 2 additions & 1 deletion crates/next-core/src/next_image/module.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use serde::{Deserialize, Serialize};
use turbo_rcstr::rcstr;
use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, Vc, fxindexmap, trace::TraceRawVcs};
use turbopack::{ModuleAssetContext, module_options::CustomModuleType};
use turbopack_core::{
Expand Down Expand Up @@ -65,7 +66,7 @@ impl StructuredImageModuleType {
.cell(),
),
ReferenceType::Internal(ResolvedVc::cell(fxindexmap!(
"IMAGE".into() => ResolvedVc::upcast(static_asset)
rcstr!("IMAGE") => ResolvedVc::upcast(static_asset)
))),
)
.module())
Expand Down
5 changes: 2 additions & 3 deletions crates/next-core/src/next_server/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,8 @@ struct ExternalizeIssue {

#[turbo_tasks::value_impl]
impl Issue for ExternalizeIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
IssueSeverity::Warning.cell()
fn severity(&self) -> IssueSeverity {
IssueSeverity::Warning
}

#[turbo_tasks::function]
Expand Down
9 changes: 4 additions & 5 deletions crates/next-core/src/next_shared/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::LazyLock;

use anyhow::Result;
use rustc_hash::FxHashMap;
use turbo_rcstr::RcStr;
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_fs::{FileSystemPath, glob::Glob};
use turbopack_core::{
Expand Down Expand Up @@ -52,9 +52,8 @@ pub struct InvalidImportModuleIssue {

#[turbo_tasks::value_impl]
impl Issue for InvalidImportModuleIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
IssueSeverity::Error.into()
fn severity(&self) -> IssueSeverity {
IssueSeverity::Error
}

#[turbo_tasks::function]
Expand All @@ -64,7 +63,7 @@ impl Issue for InvalidImportModuleIssue {

#[turbo_tasks::function]
fn title(&self) -> Vc<StyledString> {
StyledString::Text("Invalid import".into()).cell()
StyledString::Text(rcstr!("Invalid import")).cell()
}

#[turbo_tasks::function]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use swc_core::{
atoms::{Atom, atom},
ecma::ast::Program,
};
use turbo_rcstr::rcstr;
use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::{ModuleRule, ModuleRuleEffect};
Expand Down Expand Up @@ -151,9 +152,8 @@ pub struct PageStaticInfoIssue {

#[turbo_tasks::value_impl]
impl Issue for PageStaticInfoIssue {
#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
self.severity.into()
fn severity(&self) -> IssueSeverity {
self.severity
}

#[turbo_tasks::function]
Expand All @@ -163,7 +163,7 @@ impl Issue for PageStaticInfoIssue {

#[turbo_tasks::function]
fn title(&self) -> Vc<StyledString> {
StyledString::Text("Invalid page configuration".into()).cell()
StyledString::Text(rcstr!("Invalid page configuration")).cell()
}

#[turbo_tasks::function]
Expand Down
26 changes: 13 additions & 13 deletions crates/next-core/src/next_shared/webpack_rules/babel.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anyhow::Result;
use turbo_rcstr::rcstr;
use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_fs::{self, FileSystemEntryType, FileSystemPath};
use turbopack::module_options::{LoaderRuleItem, OptionWebpackRules, WebpackRules};
Expand Down Expand Up @@ -66,15 +67,15 @@ pub async fn maybe_add_babel_loader(
{
BabelIssue {
path: project_root.to_resolved().await?,
title: StyledString::Text(
"Unable to resolve babel-loader, but a babel config is present".into(),
)
title: StyledString::Text(rcstr!(
"Unable to resolve babel-loader, but a babel config is present"
))
.resolved_cell(),
description: StyledString::Text(
"Make sure babel-loader is installed via your package manager.".into(),
)
description: StyledString::Text(rcstr!(
"Make sure babel-loader is installed via your package manager."
))
.resolved_cell(),
severity: IssueSeverity::Fatal.resolved_cell(),
severity: IssueSeverity::Fatal,
}
.resolved_cell()
.emit();
Expand All @@ -83,7 +84,7 @@ pub async fn maybe_add_babel_loader(
}

let loader = WebpackLoaderItem {
loader: "babel-loader".into(),
loader: rcstr!("babel-loader"),
options: Default::default(),
};
if let Some(rule) = rule {
Expand All @@ -95,7 +96,7 @@ pub async fn maybe_add_babel_loader(
pattern.into(),
LoaderRuleItem {
loaders: ResolvedVc::cell(vec![loader]),
rename_as: Some("*".into()),
rename_as: Some(rcstr!("*")),
},
);
}
Expand Down Expand Up @@ -127,7 +128,7 @@ struct BabelIssue {
path: ResolvedVc<FileSystemPath>,
title: ResolvedVc<StyledString>,
description: ResolvedVc<StyledString>,
severity: ResolvedVc<IssueSeverity>,
severity: IssueSeverity,
}

#[turbo_tasks::value_impl]
Expand All @@ -137,9 +138,8 @@ impl Issue for BabelIssue {
IssueStage::Transform.into()
}

#[turbo_tasks::function]
fn severity(&self) -> Vc<IssueSeverity> {
*self.severity
fn severity(&self) -> IssueSeverity {
self.severity
}

#[turbo_tasks::function]
Expand Down
Loading