Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/next-custom-transforms/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ DEALINGS IN THE SOFTWARE.

#![recursion_limit = "2048"]
#![deny(clippy::all)]
#![feature(box_patterns)]
#![feature(deref_patterns)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl ImportMap {
}

Expr::Member(MemberExpr {
obj: box Expr::Ident(obj),
obj: Expr::Ident(obj),
prop: MemberProp::Ident(prop),
..
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn effect_has_side_effect_deps(call: &CallExpr) -> bool {
if let Expr::Array(arr) = &*call.args[1].expr {
for elem in arr.elems.iter().flatten() {
if let ExprOrSpread {
expr: box Expr::Call(_),
expr: Expr::Call(_),
..
} = elem
{
Expand Down Expand Up @@ -137,7 +137,7 @@ impl Fold for OptimizeServerReact {

fn fold_expr(&mut self, expr: Expr) -> Expr {
if let Expr::Call(call) = &expr {
if let Callee::Expr(box Expr::Ident(f)) = &call.callee {
if let Callee::Expr(Expr::Ident(f)) = &call.callee {
// Mark `useEffect` as DCE'able
if let Some(use_effect_ident) = &self.use_effect_ident
&& &f.to_id() == use_effect_ident
Expand All @@ -154,7 +154,7 @@ impl Fold for OptimizeServerReact {
return wrap_expr_with_env_prod_condition(call.clone());
}
} else if let Some(react_ident) = &self.react_ident
&& let Callee::Expr(box Expr::Member(member)) = &call.callee
&& let Callee::Expr(Expr::Member(member)) = &call.callee
&& let Expr::Ident(f) = &*member.obj
&& &f.to_id() == react_ident
&& let MemberProp::Ident(i) = &member.prop
Expand All @@ -179,8 +179,8 @@ impl Fold for OptimizeServerReact {

if let Pat::Array(array_pat) = &decl.name
&& array_pat.elems.len() == 2
&& let Some(box Expr::Call(call)) = &decl.init
&& let Callee::Expr(box Expr::Ident(f)) = &call.callee
&& let Some(Expr::Call(call)) = &decl.init
&& let Callee::Expr(Expr::Ident(f)) = &call.callee
&& let Some(use_state_ident) = &self.use_state_ident
&& &f.to_id() == use_state_ident
&& call.args.len() == 1
Expand Down
24 changes: 12 additions & 12 deletions crates/next-custom-transforms/src/transforms/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1567,15 +1567,15 @@ impl<C: Comments> VisitMut for ServerActions<C> {
let old_current_export_name = self.current_export_name.take();

match n {
PropOrSpread::Prop(box Prop::KeyValue(KeyValueProp {
PropOrSpread::Prop(Prop::KeyValue(KeyValueProp {
key: PropName::Ident(ident_name),
value: box Expr::Arrow(_) | box Expr::Fn(_),
value: Expr::Arrow(_) | Expr::Fn(_),
..
})) => {
self.current_export_name = None;
self.arrow_or_fn_expr_ident = Some(ident_name.clone().into());
}
PropOrSpread::Prop(box Prop::Method(MethodProp { key, .. })) => {
PropOrSpread::Prop(Prop::Method(MethodProp { key, .. })) => {
let key = key.clone();

if let PropName::Ident(ident_name) = &key {
Expand Down Expand Up @@ -1603,7 +1603,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {

if !self.in_module_level
&& self.should_track_names
&& let PropOrSpread::Prop(box Prop::Shorthand(i)) = n
&& let PropOrSpread::Prop(Prop::Shorthand(i)) = n
{
self.names.push(Name::from(&*i));
self.should_track_names = false;
Expand Down Expand Up @@ -1686,7 +1686,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
}

fn visit_mut_call_expr(&mut self, n: &mut CallExpr) {
if let Callee::Expr(box Expr::Ident(Ident { sym, .. })) = &mut n.callee
if let Callee::Expr(Expr::Ident(Ident { sym, .. })) = &mut n.callee
&& (sym == "jsxDEV" || sym == "_jsxDEV")
{
// Do not visit the 6th arg in a generated jsxDEV call, which is a `this`
Expand Down Expand Up @@ -2837,7 +2837,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
(&attr.value, &attr.name)
{
match &container.expr {
JSXExpr::Expr(box Expr::Arrow(_)) | JSXExpr::Expr(box Expr::Fn(_)) => {
JSXExpr::Expr(Expr::Arrow(_)) | JSXExpr::Expr(Expr::Fn(_)) => {
self.arrow_or_fn_expr_ident = Some(ident_name.clone().into());
}
_ => {}
Expand All @@ -2852,7 +2852,7 @@ impl<C: Comments> VisitMut for ServerActions<C> {
let old_current_export_name = self.current_export_name.take();
let old_arrow_or_fn_expr_ident = self.arrow_or_fn_expr_ident.take();

if let (Pat::Ident(ident), Some(box Expr::Arrow(_) | box Expr::Fn(_))) =
if let (Pat::Ident(ident), Some(Expr::Arrow(_) | Expr::Fn(_))) =
(&var_declarator.name, &var_declarator.init)
{
if self.in_module_level
Expand Down Expand Up @@ -3301,7 +3301,7 @@ fn has_body_directive(maybe_body: &Option<BlockStmt>) -> (bool, bool) {
for stmt in body.stmts.iter() {
match stmt {
Stmt::Expr(ExprStmt {
expr: box Expr::Lit(Lit::Str(Str { value, .. })),
expr: Expr::Lit(Lit::Str(Str { value, .. })),
..
}) => {
if value == "use server" {
Expand Down Expand Up @@ -3440,7 +3440,7 @@ impl DirectiveVisitor<'_> {

match stmt {
Stmt::Expr(ExprStmt {
expr: box Expr::Lit(Lit::Str(Str { value, span, .. })),
expr: Expr::Lit(Lit::Str(Str { value, span, .. })),
..
}) => {
if value == "use server" {
Expand Down Expand Up @@ -3575,8 +3575,8 @@ impl DirectiveVisitor<'_> {
}
Stmt::Expr(ExprStmt {
expr:
box Expr::Paren(ParenExpr {
expr: box Expr::Lit(Lit::Str(Str { value, .. })),
Expr::Paren(ParenExpr {
expr: Expr::Lit(Lit::Str(Str { value, .. })),
..
}),
span,
Expand Down Expand Up @@ -3668,7 +3668,7 @@ impl VisitMut for ClosureReplacer<'_> {
fn visit_mut_prop_or_spread(&mut self, n: &mut PropOrSpread) {
n.visit_mut_children_with(self);

if let PropOrSpread::Prop(box Prop::Shorthand(i)) = n {
if let PropOrSpread::Prop(Prop::Shorthand(i)) = n {
let name = Name::from(&*i);
if let Some(index) = self.used_ids.iter().position(|used_id| *used_id == name) {
*n = PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp {
Expand Down
28 changes: 14 additions & 14 deletions turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,13 @@ impl TurboTasksBackend {
done_event,
))))
}
Some(InProgressState::InProgress(box InProgressStateInner {
done_event, ..
})) => Some(Ok(ReadOutcome::InProgress(listen_to_done_event(
reader_description,
tracking,
done_event,
)))),
Some(InProgressState::InProgress(InProgressStateInner { done_event, .. })) => {
Some(Ok(ReadOutcome::InProgress(listen_to_done_event(
reader_description,
tracking,
done_event,
))))
}
Some(InProgressState::Canceled) => Some(Err(anyhow::anyhow!(
"{} was canceled",
task.get_task_description()
Expand Down Expand Up @@ -1869,7 +1869,7 @@ impl TurboTasksBackend {
done_event,
reason: _,
} => done_event.notify(usize::MAX),
InProgressState::InProgress(box InProgressStateInner { done_event, .. }) => {
InProgressState::InProgress(InProgressStateInner { done_event, .. }) => {
done_event.notify(usize::MAX)
}
InProgressState::Canceled => {}
Expand Down Expand Up @@ -2210,7 +2210,7 @@ impl TurboTasksBackend {
is_session_dependent,
});
}
let &mut InProgressState::InProgress(box InProgressStateInner {
let &mut InProgressState::InProgress(InProgressStateInner {
stale,
ref mut new_children,
once_task: is_once_task,
Expand All @@ -2224,7 +2224,7 @@ impl TurboTasksBackend {
#[cfg(not(feature = "no_fast_stale"))]
if stale && !is_once_task {
let stale_priority = compute_stale_priority(&task);
let Some(InProgressState::InProgress(box InProgressStateInner {
let Some(InProgressState::InProgress(InProgressStateInner {
done_event,
mut new_children,
..
Expand Down Expand Up @@ -2609,7 +2609,7 @@ impl TurboTasksBackend {
// Task was canceled in the meantime, so we don't connect the children
return None;
}
let InProgressState::InProgress(box InProgressStateInner {
let InProgressState::InProgress(InProgressStateInner {
#[cfg(not(feature = "no_fast_stale"))]
stale,
once_task: is_once_task,
Expand All @@ -2623,7 +2623,7 @@ impl TurboTasksBackend {
#[cfg(not(feature = "no_fast_stale"))]
if *stale && !is_once_task {
let stale_priority = compute_stale_priority(&task);
let Some(InProgressState::InProgress(box InProgressStateInner { done_event, .. })) =
let Some(InProgressState::InProgress(InProgressStateInner { done_event, .. })) =
task.take_in_progress()
else {
unreachable!();
Expand Down Expand Up @@ -2685,7 +2685,7 @@ impl TurboTasksBackend {
// Task was canceled in the meantime, so we don't finish it
return (None, None);
}
let InProgressState::InProgress(box InProgressStateInner {
let InProgressState::InProgress(InProgressStateInner {
done_event,
once_task: is_once_task,
stale,
Expand Down Expand Up @@ -3250,7 +3250,7 @@ impl TurboTasksBackend {
fn mark_own_task_as_finished(&self, task: TaskId, turbo_tasks: &TurboTasks<TurboTasksBackend>) {
let mut ctx = self.execute_context(turbo_tasks);
let mut task = ctx.task(task, TaskDataCategory::Data);
if let Some(InProgressState::InProgress(box InProgressStateInner {
if let Some(InProgressState::InProgress(InProgressStateInner {
marked_as_completed,
..
})) = task.get_in_progress_mut()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ impl AggregationUpdateQueue {
self.inner_of_upper_lost_followers(ctx, lost_follower_ids, upper_id, retry);
}
}
AggregationUpdateJob::AggregatedDataUpdate(box AggregatedDataUpdateJob {
AggregationUpdateJob::AggregatedDataUpdate(AggregatedDataUpdateJob {
upper_ids,
update,
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ impl ConnectChildOperation {
) {
if let Some(parent_task_id) = parent_task_id {
let mut parent_task = ctx.task(parent_task_id, TaskDataCategory::Meta);
let Some(InProgressState::InProgress(box InProgressStateInner {
new_children, ..
})) = parent_task.get_in_progress()
let Some(InProgressState::InProgress(InProgressStateInner { new_children, .. })) =
parent_task.get_in_progress()
else {
panic!("Task is not in progress while calling another task: {parent_task:?}");
};
Expand All @@ -49,9 +48,8 @@ impl ConnectChildOperation {
if parent_task.children_contains(&child_task_id) {
// It is already connected, we can skip the rest
// but we still need to update the new_children set
let Some(InProgressState::InProgress(box InProgressStateInner {
new_children,
..
let Some(InProgressState::InProgress(InProgressStateInner {
new_children, ..
})) = parent_task.get_in_progress_mut()
else {
unreachable!();
Expand Down Expand Up @@ -118,9 +116,8 @@ impl ConnectChildOperation {

if let Some(parent_task_id) = parent_task_id {
let mut parent_task = ctx.task(parent_task_id, TaskDataCategory::Meta);
let Some(InProgressState::InProgress(box InProgressStateInner {
new_children, ..
})) = parent_task.get_in_progress_mut()
let Some(InProgressState::InProgress(InProgressStateInner { new_children, .. })) =
parent_task.get_in_progress_mut()
else {
panic!("Task is not in progress while calling another task: {parent_task:?}");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub fn make_task_dirty_internal(
#[cfg(feature = "trace_task_dirty")]
let task_name = task.get_task_name();
if make_stale
&& let Some(InProgressState::InProgress(box InProgressStateInner { stale, .. })) =
&& let Some(InProgressState::InProgress(InProgressStateInner { stale, .. })) =
task.get_in_progress_mut()
&& !*stale
{
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbo-tasks-backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(anonymous_lifetime_in_impl_trait)]
#![feature(box_patterns)]
#![feature(deref_patterns)]

mod backend;
mod backing_storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ impl EvalContext {
// Only treat literals as constant undefined, allowing arbitrary values inside here
// would mean that they can have sideeffects, and `JsValue::Constant` can't model
// that.
arg: box Expr::Lit(_),
arg: Expr::Lit(_),
..
}) => JsValue::Constant(ConstantValue::Undefined),

Expr::Unary(UnaryExpr {
op: op!(unary, "-"),
arg: box Expr::Lit(Lit::Num(n)),
arg: Expr::Lit(Lit::Num(n)),
..
}) => JsValue::Constant(ConstantValue::Num(ConstantNumber(-n.value))),

Expand Down Expand Up @@ -288,9 +288,9 @@ impl EvalContext {
}) => JsValue::r#in(arena, self.eval(arena, left), self.eval(arena, right)),

&Expr::Cond(CondExpr {
box ref cons,
box ref alt,
box ref test,
ref cons,
ref alt,
ref test,
..
}) => {
let test = self.eval(arena, test);
Expand All @@ -309,8 +309,8 @@ impl EvalContext {

Expr::TaggedTpl(TaggedTpl {
tag:
box Expr::Member(MemberExpr {
obj: box Expr::Ident(tag_obj),
Expr::Member(MemberExpr {
obj: Expr::Ident(tag_obj),
prop: MemberProp::Ident(tag_prop),
..
}),
Expand Down Expand Up @@ -380,11 +380,7 @@ impl EvalContext {
JsValue::member(arena, obj, prop)
}

Expr::New(NewExpr {
callee: box callee,
args,
..
}) => {
Expr::New(NewExpr { callee, args, .. }) => {
let args = args.as_deref().unwrap_or(&[]);
// We currently do not handle spreads.
if args.iter().any(|arg| arg.spread.is_some()) {
Expand All @@ -402,7 +398,7 @@ impl EvalContext {
}

Expr::Call(CallExpr {
callee: Callee::Expr(box callee),
callee: Callee::Expr(callee),
args,
..
}) => {
Expand Down Expand Up @@ -505,13 +501,13 @@ impl EvalContext {
PropOrSpread::Spread(SpreadElement { expr, .. }) => {
ObjectPart::Spread(self.eval(arena, expr))
}
PropOrSpread::Prop(box Prop::KeyValue(KeyValueProp { key, box value })) => {
PropOrSpread::Prop(Prop::KeyValue(KeyValueProp { key, value })) => {
ObjectPart::KeyValue(
self.eval_prop_name(arena, key),
self.eval(arena, value),
)
}
PropOrSpread::Prop(box Prop::Shorthand(ident)) => ObjectPart::KeyValue(
PropOrSpread::Prop(Prop::Shorthand(ident)) => ObjectPart::KeyValue(
ident.sym.clone().into(),
self.eval(arena, &Expr::Ident(ident.clone())),
),
Expand Down
Loading
Loading