Skip to content

Commit 2103f4c

Browse files
committed
chore(rust): upgrade + fix unstable changes
1 parent 6b6b3ac commit 2103f4c

File tree

7 files changed

+16
-14
lines changed

7 files changed

+16
-14
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ members = [
66
"packages/qwik/src/optimizer/core",
77
]
88
exclude = ["packages/qwik/src/wasm"]
9+
resolver = "2"
910

1011
[profile.release]
1112
debug = 0

packages/qwik/src/optimizer/core/src/clean_side_effects.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl VisitMut for CleanMarker {
3838

3939
impl VisitMut for CleanSideEffects {
4040
fn visit_mut_module(&mut self, node: &mut ast::Module) {
41-
node.body.drain_filter(|item| {
41+
let it = node.body.extract_if(|item| {
4242
if item.span().has_mark(self.mark) {
4343
return false;
4444
}
@@ -53,5 +53,7 @@ impl VisitMut for CleanSideEffects {
5353
_ => false,
5454
}
5555
});
56+
// Consume the iterator to force the extraction.
57+
for _ in it {}
5658
}
5759
}

packages/qwik/src/optimizer/core/src/collector.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ impl Visit for IdentCollector {
374374
}
375375

376376
fn visit_ident(&mut self, node: &ast::Ident) {
377-
if let Some(ExprOrSkip::Expr) = self.expr_ctxt.last() {
378-
if node.span.ctxt() != SyntaxContext::empty() {
379-
self.local_idents.insert(id!(node));
380-
}
377+
if matches!(self.expr_ctxt.last(), Some(ExprOrSkip::Expr))
378+
&& node.span.ctxt() != SyntaxContext::empty()
379+
{
380+
self.local_idents.insert(id!(node));
381381
}
382382
}
383383

packages/qwik/src/optimizer/core/src/entry_strategy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub fn parse_entry_strategy(
183183
manual_chunks: Option<HashMap<String, JsWord>>,
184184
) -> Box<dyn EntryPolicy> {
185185
match strategy {
186-
EntryStrategy::Inline | EntryStrategy::Hoist => Box::new(InlineStrategy::default()),
186+
EntryStrategy::Inline | EntryStrategy::Hoist => Box::<InlineStrategy>::default(),
187187
EntryStrategy::Hook => Box::new(PerHookStrategy::new(manual_chunks)),
188188
EntryStrategy::Single => Box::new(SingleStrategy::new(manual_chunks)),
189189
EntryStrategy::Component => Box::new(PerComponentStrategy::new(manual_chunks)),

packages/qwik/src/optimizer/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![feature(box_patterns)]
66
#![allow(clippy::option_if_let_else)]
77
#![allow(clippy::iter_with_drain)]
8-
#![feature(drain_filter)]
8+
#![feature(extract_if)]
99
#[cfg(test)]
1010
mod test;
1111

packages/qwik/src/optimizer/core/src/transform.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ impl<'a> QwikTransform<'a> {
317317
display_name += "s_";
318318
}
319319
display_name = escape_sym(&display_name);
320-
if display_name.starts_with(|c| matches!(c, '0'..='9')) {
320+
let first_char = display_name.chars().next();
321+
if first_char.map_or(false, |c| c.is_ascii_digit()) {
321322
display_name = format!("_{}", display_name);
322323
}
323324
let index = match self.hooks_names.get_mut(&display_name) {
@@ -1745,7 +1746,6 @@ impl<'a> Fold for QwikTransform<'a> {
17451746
{
17461747
self.hooks
17471748
.drain(..)
1748-
.into_iter()
17491749
.map(|hook| {
17501750
let id = (hook.name.clone(), SyntaxContext::from_u32(hook.hash as u32));
17511751
ast::ModuleItem::Stmt(ast::Stmt::Decl(ast::Decl::Var(Box::new(
@@ -2170,12 +2170,11 @@ impl<'a> Fold for QwikTransform<'a> {
21702170
} else {
21712171
let new_specifier =
21722172
convert_signal_word(&ident.sym).expect("Specifier ends with $");
2173-
let new_local = global_collect
2173+
global_collect
21742174
.exports
21752175
.keys()
2176-
.find(|id| id.0 == new_specifier);
2177-
2178-
new_local.map_or_else(
2176+
.find(|id| id.0 == new_specifier)
2177+
.map_or_else(
21792178
|| {
21802179
HANDLER.with(|handler| {
21812180
handler

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2022-09-23
1+
nightly-2023-06-23

0 commit comments

Comments
 (0)