From 66b98db7c6d8660eca0c987c9a8c8a5002f92269 Mon Sep 17 00:00:00 2001 From: _Kerman Date: 2025年2月10日 14:02:22 +0800 Subject: [PATCH 1/2] chore: remove unused file --- crates/tree_shaker/src/entity/entity.rs | 1 - crates/tree_shaker/src/entity/mod.rs | 1 - 2 files changed, 2 deletions(-) delete mode 100644 crates/tree_shaker/src/entity/entity.rs diff --git a/crates/tree_shaker/src/entity/entity.rs b/crates/tree_shaker/src/entity/entity.rs deleted file mode 100644 index 8b137891..00000000 --- a/crates/tree_shaker/src/entity/entity.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/tree_shaker/src/entity/mod.rs b/crates/tree_shaker/src/entity/mod.rs index 0a93ad64..dd6eb0c6 100644 --- a/crates/tree_shaker/src/entity/mod.rs +++ b/crates/tree_shaker/src/entity/mod.rs @@ -6,7 +6,6 @@ mod collected; mod collector; mod computed; mod consumed_object; -mod entity; mod factory; mod function; mod literal; From e36cfa922aa7a4be7e972c1fa4eea1fede0ce87e Mon Sep 17 00:00:00 2001 From: _Kerman Date: 2025年2月10日 14:38:38 +0800 Subject: [PATCH 2/2] chore: upgrade oxc --- Cargo.lock | 92 +++++++++---------- Cargo.toml | 6 +- .../src/builtins/globals/constants.rs | 2 +- .../tree_shaker/src/builtins/globals/mod.rs | 2 +- .../src/builtins/prototypes/mod.rs | 2 +- .../tree_shaker/src/consumable/collector.rs | 5 +- crates/tree_shaker/src/consumable/mod.rs | 3 +- crates/tree_shaker/src/entity/array.rs | 2 +- .../tree_shaker/src/entity/object/property.rs | 2 +- crates/tree_shaker/src/entity/unknown.rs | 2 +- crates/tree_shaker/src/entity/utils.rs | 14 ++- .../src/nodes/jsx/jsx_member_expression.rs | 2 +- crates/tree_shaker/src/scope/conditional.rs | 2 +- crates/tree_shaker/src/scope/exhaustive.rs | 4 +- crates/tree_shaker/src/scope/loop.rs | 2 +- .../tree_shaker/src/scope/variable_scope.rs | 2 +- crates/tree_shaker/src/tree_shaker.rs | 2 +- crates/tree_shaker/src/utils/annotation.rs | 2 +- crates/tree_shaker/src/utils/ast.rs | 4 +- crates/tree_shaker/src/utils/dep_id.rs | 10 +- crates/tree_shaker/src/utils/function_name.rs | 6 +- rust-toolchain.toml | 2 +- 22 files changed, 87 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2f0f859c..8ed0a9ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -444,12 +444,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "foldhash" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" - [[package]] name = "globset" version = "0.4.15" @@ -486,8 +480,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", - "equivalent", - "foldhash", ] [[package]] @@ -786,9 +778,9 @@ checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" [[package]] name = "oxc" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd3e3fef7c8454e74017bda0cf5ddb0328b4dbecd67a0f5c72b00be2799d0e12" +checksum = "fa88d4faa0cf3e4bcdebb0d10b8627776a8d3b036d76d85787e076198886f04e" dependencies = [ "oxc_allocator", "oxc_ast", @@ -830,20 +822,22 @@ dependencies = [ [[package]] name = "oxc_allocator" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd735ac4f5202cd854cc1f23b334de42e034ed89b07ea5acc183c629ac961922" +checksum = "17374a91329f2e362bc8be31cb3e171ef226777d0ea668e17a39620443693027" dependencies = [ "allocator-api2", "bumpalo", + "hashbrown 0.15.2", + "rustc-hash", "simdutf8", ] [[package]] name = "oxc_ast" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c509311d40c5364ecd88b4dbc5f69634eb7e760bd1d549863c6d74bc4be26c33" +checksum = "21b38cfe954ee987354af015020f5cb2723df6fed6cd688eff24388437c7eb7e" dependencies = [ "bitflags", "cow-utils", @@ -859,9 +853,9 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920d141997d08c4d3110c5461418e23270e484f608b4e5c4d186ad794cef5c51" +checksum = "85f9e03eff90b041078edcc8aff09457eb4126fa5d62a383fdb082d3ae286274" dependencies = [ "proc-macro2", "quote", @@ -870,9 +864,9 @@ dependencies = [ [[package]] name = "oxc_cfg" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f1234386c2df9690b8bcc3f4da22ab27ceb699ee1ed40a803ae4029aa6eb6c5" +checksum = "20347f1cff149f8d7354b0a16877714f4e3f7d6eb4f5cd659c3de1d5d283e846" dependencies = [ "bitflags", "itertools 0.14.0", @@ -885,9 +879,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3974d4e1727035d012401743e95d81956341d7baf84c9d318996ee36f1e658ca" +checksum = "d5bd847bc5d8a2b5a620e33e0b0422fc8ddb6c85562de97da6fe86659dfd571b" dependencies = [ "assert-unchecked", "bitflags", @@ -895,19 +889,21 @@ dependencies = [ "nonmax", "oxc_allocator", "oxc_ast", + "oxc_data_structures", "oxc_index", - "oxc_mangler", + "oxc_semantic", "oxc_sourcemap", "oxc_span", "oxc_syntax", "rustc-hash", + "ryu-js", ] [[package]] name = "oxc_data_structures" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a1dbe29d67d3ed8b8f6582dd0b1de3b50c10f3e8f6505cef2340205eccc2c2" +checksum = "3697dd172835a236572748761301a7e3a17fb770cf30bb771ec10982fcbd86c8" dependencies = [ "assert-unchecked", "ropey", @@ -915,19 +911,19 @@ dependencies = [ [[package]] name = "oxc_diagnostics" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7987595069022940d1100d0206b3ccbbb6f7f35a0cc61a12031d3a4079abba84" +checksum = "a24c41929c1910d83fb6f4c508190a8b2d1bad02e81c8cb3a9d3f474ca0ad2c1" dependencies = [ + "cow-utils", "oxc-miette", - "rustc-hash", ] [[package]] name = "oxc_ecmascript" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d95c9815396146b129c43deaab2d9f136c14ed2883663133edf81a0f77d7d6" +checksum = "30fba86c97b571671f941b818e6831ba821aac398b9f6f3b4e3367ca264b8324" dependencies = [ "num-bigint", "num-traits", @@ -938,9 +934,9 @@ dependencies = [ [[package]] name = "oxc_estree" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "987b6d27d27d361009a61167c6a925053e840eadddf62136060772af0f5e9692" +checksum = "e587034bb5f108dd987e5419a4ad35a173550bd9439fc2b610d34e4ce41e8b23" [[package]] name = "oxc_index" @@ -950,11 +946,11 @@ checksum = "5eca5d9726cd0a6e433debe003b7bc88b2ecad0bb6109f0cef7c55e692139a34" [[package]] name = "oxc_mangler" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cffde4bbb35698c67efaeb03989c836a01e62a59f82231831df9eafb60f221" +checksum = "5bd6c4138580a7df85ea5eb141014c86e4f19e7496eec91797b05ab73d8fb65e" dependencies = [ - "compact_str", + "fixedbitset", "itertools 0.14.0", "oxc_allocator", "oxc_ast", @@ -966,14 +962,15 @@ dependencies = [ [[package]] name = "oxc_minifier" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5296200ce3031aea47ffbc214ecaae24ebcb5534ab84232b418611d2313e55" +checksum = "c8d47fca4d49091775dd659cf54b4ae361ea48607f8dc6595970840ee0c5bf25" dependencies = [ "cow-utils", "oxc_allocator", "oxc_ast", "oxc_codegen", + "oxc_data_structures", "oxc_ecmascript", "oxc_mangler", "oxc_parser", @@ -986,9 +983,9 @@ dependencies = [ [[package]] name = "oxc_parser" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e9f2e3a80279537b52ffab68282e09062a8794c421bc7e57c6b9b5060a8447" +checksum = "8dc385aca3586877f8c918aed1141b885dedcfc1019d6ea5be4105f8e2a7965e" dependencies = [ "assert-unchecked", "bitflags", @@ -1009,9 +1006,9 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22065fe1523c70162b00cd6ac6e5b9ddd521cedf4f691801f0d024ee1f619a40" +checksum = "f8d172402f6d542ab2837d35126cc42ad6989b9c2289b06bc5c8c89dceb60c48" dependencies = [ "oxc_allocator", "oxc_ast_macros", @@ -1025,12 +1022,11 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca7a8365faa0603f314b62b24cd751342455bd339f8d25d354f7dfd2c48628a" +checksum = "7ceb1f387b1ded0c84bdbc1f14eb087204cb9cd9ca4b4ff867be8d1575c7b20a" dependencies = [ "assert-unchecked", - "hashbrown 0.15.2", "itertools 0.14.0", "oxc_allocator", "oxc_ast", @@ -1062,9 +1058,9 @@ dependencies = [ [[package]] name = "oxc_span" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "394f0317461a29c55a50a05c70e3ea23694cdb3748ff7adab979a6a60c2cb709" +checksum = "75881376dfdbb6a23f12a66794904f0d215629f208edcf7e156c0770e89e2101" dependencies = [ "compact_str", "oxc-miette", @@ -1075,9 +1071,9 @@ dependencies = [ [[package]] name = "oxc_syntax" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc1cad48f366df99384009928eae2b5dab39b629123b704ccb03221d41eddf4" +checksum = "c6d88037a5de07f66299ab523a65545cc48d550658cea8cadcea09b60596dd49" dependencies = [ "assert-unchecked", "bitflags", @@ -1096,9 +1092,9 @@ dependencies = [ [[package]] name = "oxc_traverse" -version = "0.46.0" +version = "0.48.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4412a996bc23128a07454bc729f96ff212f66191f854710164505ea5156435d" +checksum = "2dff651953c5b30cc0c5595e8da0aeb1a803a02d79199456d7d73b71c3d0a0be" dependencies = [ "compact_str", "itoa", diff --git a/Cargo.toml b/Cargo.toml index 89416dbd..2445d760 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,10 @@ dashmap = "6.0.1" flame = "0.2.2" flamescope = "0.1.3" line-index = "0.1.2" -oxc = "0.46.0" -oxc_ecmascript = "0.46.0" +oxc = "0.48.2" +oxc_ecmascript = "0.48.2" oxc_index = "2.0.0" -oxc_syntax = "0.46.0" +oxc_syntax = "0.48.2" regex = "1.10.6" rustc-hash = "2.0.0" insta = "1.39.0" diff --git a/crates/tree_shaker/src/builtins/globals/constants.rs b/crates/tree_shaker/src/builtins/globals/constants.rs index 2ffe7d8b..7cc5eb31 100644 --- a/crates/tree_shaker/src/builtins/globals/constants.rs +++ b/crates/tree_shaker/src/builtins/globals/constants.rs @@ -1,6 +1,6 @@ use crate::{builtins::Builtins, init_map}; -impl<'a> Builtins<'a> { +impl Builtins<'_> { pub fn init_global_constants(&mut self) { let factory = self.factory; diff --git a/crates/tree_shaker/src/builtins/globals/mod.rs b/crates/tree_shaker/src/builtins/globals/mod.rs index 5a0d685a..f6163aaa 100644 --- a/crates/tree_shaker/src/builtins/globals/mod.rs +++ b/crates/tree_shaker/src/builtins/globals/mod.rs @@ -3,7 +3,7 @@ mod object_constructor; use super::Builtins; -impl<'a> Builtins<'a> { +impl Builtins<'_> { pub fn init_globals(&mut self) { self.init_global_constants(); self.init_object_constructor(); diff --git a/crates/tree_shaker/src/builtins/prototypes/mod.rs b/crates/tree_shaker/src/builtins/prototypes/mod.rs index 8fd509c1..c0574084 100644 --- a/crates/tree_shaker/src/builtins/prototypes/mod.rs +++ b/crates/tree_shaker/src/builtins/prototypes/mod.rs @@ -30,7 +30,7 @@ pub struct Prototype<'a> { symbol_keyed: FxHashMap>, } -impl<'a> fmt::Debug for Prototype<'a> { +impl fmt::Debug for Prototype<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(format!("Prototype({})", self.name).as_str()) } diff --git a/crates/tree_shaker/src/consumable/collector.rs b/crates/tree_shaker/src/consumable/collector.rs index 724ad2f6..63fec3a1 100644 --- a/crates/tree_shaker/src/consumable/collector.rs +++ b/crates/tree_shaker/src/consumable/collector.rs @@ -1,10 +1,11 @@ use super::{Consumable, ConsumableTrait}; use crate::{analyzer::Analyzer, entity::EntityFactory}; +use oxc::allocator; use std::mem; #[derive(Debug)] pub struct ConsumableCollector<'a, T: ConsumableTrait<'a> + 'a = Consumable<'a>> { - pub current: Vec, + pub current: allocator::Vec<'a, T>, pub node: Option>, } @@ -15,7 +16,7 @@ impl<'a, T: ConsumableTrait<'a> + 'a> Default for ConsumableCollector<'a, T> { } impl<'a, T: ConsumableTrait<'a> + 'a> ConsumableCollector<'a, T> { - pub fn new(current: Vec) -> Self { + pub fn new(current: allocator::Vec) -> Self { Self { current, node: None } } diff --git a/crates/tree_shaker/src/consumable/mod.rs b/crates/tree_shaker/src/consumable/mod.rs index 8ee8a4ce..dbbba927 100644 --- a/crates/tree_shaker/src/consumable/mod.rs +++ b/crates/tree_shaker/src/consumable/mod.rs @@ -7,6 +7,7 @@ use crate::{analyzer::Analyzer, entity::EntityFactory}; pub use collector::*; pub use lazy::*; use once::OnceConsumable; +use oxc::allocator; use std::fmt::Debug; pub trait ConsumableTrait<'a>: Debug { @@ -16,7 +17,7 @@ pub trait ConsumableTrait<'a>: Debug { #[derive(Debug, Clone, Copy)] pub struct Consumable<'a>(pub &'a (dyn ConsumableTrait<'a> + 'a)); -pub type ConsumableVec<'a> = Vec>; +pub type ConsumableVec<'a> = allocator::Vec<'a, Consumable<'a>>; impl<'a> EntityFactory<'a> { pub fn consumable_no_once(&self, dep: impl ConsumableTrait<'a> + 'a) -> Consumable<'a> { diff --git a/crates/tree_shaker/src/entity/array.rs b/crates/tree_shaker/src/entity/array.rs index c916538b..66adc92a 100644 --- a/crates/tree_shaker/src/entity/array.rs +++ b/crates/tree_shaker/src/entity/array.rs @@ -22,7 +22,7 @@ pub struct ArrayEntity<'a> { pub rest: RefCell>>, } -impl<'a> fmt::Debug for ArrayEntity<'a> { +impl fmt::Debug for ArrayEntity<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ArrayEntity") .field("consumed", &self.consumed.get()) diff --git a/crates/tree_shaker/src/entity/object/property.rs b/crates/tree_shaker/src/entity/object/property.rs index 55104968..c6ad350c 100644 --- a/crates/tree_shaker/src/entity/object/property.rs +++ b/crates/tree_shaker/src/entity/object/property.rs @@ -21,7 +21,7 @@ pub struct ObjectProperty<'a> { pub mangling: Option<(entity<'a>, MangleAtom)>, } -impl<'a> Default for ObjectProperty<'a> { +impl Default for ObjectProperty<'_> { fn default() -> Self { Self { definite: true, diff --git a/crates/tree_shaker/src/entity/unknown.rs b/crates/tree_shaker/src/entity/unknown.rs index b0c6e43d..d3089e27 100644 --- a/crates/tree_shaker/src/entity/unknown.rs +++ b/crates/tree_shaker/src/entity/unknown.rs @@ -131,7 +131,7 @@ impl<'a> EntityTrait<'a> for UnknownEntity<'a> { } } -impl<'a> UnknownEntity<'a> { +impl UnknownEntity<'_> { pub fn new() -> Self { Self::default() } diff --git a/crates/tree_shaker/src/entity/utils.rs b/crates/tree_shaker/src/entity/utils.rs index b3793861..889fc4e7 100644 --- a/crates/tree_shaker/src/entity/utils.rs +++ b/crates/tree_shaker/src/entity/utils.rs @@ -27,9 +27,12 @@ impl<'a, T: 'a + Copy> UnionLike<'a, T> for Vec { fn len(&self) -> usize { self.len() } - type Iter<'b> = Copied> + type Iter<'b> + = Copied> where - Self: 'b, 'a: 'b, T: 'b; + Self: 'b, + 'a: 'b, + T: 'b; fn iter<'b>(&'b self) -> Self::Iter<'b> where 'a: 'b, @@ -45,9 +48,12 @@ impl<'a, T: 'a + Copy> UnionLike<'a, T> for (T, T) { fn len(&self) -> usize { 2 } - type Iter<'b> = array::IntoIter + type Iter<'b> + = array::IntoIter where - Self: 'b, 'a: 'b, T: 'b; + Self: 'b, + 'a: 'b, + T: 'b; fn iter<'b>(&'b self) -> Self::Iter<'b> where 'a: 'b, diff --git a/crates/tree_shaker/src/nodes/jsx/jsx_member_expression.rs b/crates/tree_shaker/src/nodes/jsx/jsx_member_expression.rs index 8edfa5e7..de3d8664 100644 --- a/crates/tree_shaker/src/nodes/jsx/jsx_member_expression.rs +++ b/crates/tree_shaker/src/nodes/jsx/jsx_member_expression.rs @@ -26,7 +26,7 @@ impl<'a> Transformer<'a> { Some(Expression::from(self.ast_builder.member_expression_static( *span, object, - self.ast_builder.identifier_name(property.span, property.name.clone()), + self.ast_builder.identifier_name(property.span, property.name), false, ))) } else { diff --git a/crates/tree_shaker/src/scope/conditional.rs b/crates/tree_shaker/src/scope/conditional.rs index 930fb5cf..0854486f 100644 --- a/crates/tree_shaker/src/scope/conditional.rs +++ b/crates/tree_shaker/src/scope/conditional.rs @@ -218,7 +218,7 @@ impl<'a> Analyzer<'a> { } } -impl<'a> Transformer<'a> { +impl Transformer<'_> { pub fn get_conditional_result(&self, dep_id: impl Into) -> (bool, bool, bool) { let data = &self.conditional_data.node_to_data[&dep_id.into()]; if data.maybe_true && data.maybe_false { diff --git a/crates/tree_shaker/src/scope/exhaustive.rs b/crates/tree_shaker/src/scope/exhaustive.rs index 0f5becf7..e23da872 100644 --- a/crates/tree_shaker/src/scope/exhaustive.rs +++ b/crates/tree_shaker/src/scope/exhaustive.rs @@ -13,12 +13,12 @@ pub struct ExhaustiveCallback<'a> { pub handler: Rc) + 'a>, pub once: bool, } -impl<'a> PartialEq for ExhaustiveCallback<'a> { +impl PartialEq for ExhaustiveCallback<'_> { fn eq(&self, other: &Self) -> bool { self.once == other.once && Rc::ptr_eq(&self.handler, &other.handler) } } -impl<'a> Eq for ExhaustiveCallback<'a> {} +impl Eq for ExhaustiveCallback<'_> {} impl Hash for ExhaustiveCallback<'_> { fn hash(&self, state: &mut H) { Rc::as_ptr(&self.handler).hash(state); diff --git a/crates/tree_shaker/src/scope/loop.rs b/crates/tree_shaker/src/scope/loop.rs index f0aeb853..c523cdc2 100644 --- a/crates/tree_shaker/src/scope/loop.rs +++ b/crates/tree_shaker/src/scope/loop.rs @@ -10,7 +10,7 @@ pub struct LoopData<'a> { pub type LoopDataMap<'a> = FxHashMap>>; -impl<'a> Analyzer<'a> { +impl Analyzer<'_> { pub fn post_analyze_handle_loops(&mut self) -> bool { let mut remained = LoopDataMap::default(); let mut dirty = false; diff --git a/crates/tree_shaker/src/scope/variable_scope.rs b/crates/tree_shaker/src/scope/variable_scope.rs index d96a0075..402c54eb 100644 --- a/crates/tree_shaker/src/scope/variable_scope.rs +++ b/crates/tree_shaker/src/scope/variable_scope.rs @@ -35,7 +35,7 @@ impl fmt::Debug for VariableScope<'_> { } } -impl<'a> VariableScope<'a> { +impl VariableScope<'_> { pub fn new() -> Self { Self::default() } diff --git a/crates/tree_shaker/src/tree_shaker.rs b/crates/tree_shaker/src/tree_shaker.rs index 43f76de6..0d1c7605 100644 --- a/crates/tree_shaker/src/tree_shaker.rs +++ b/crates/tree_shaker/src/tree_shaker.rs @@ -78,7 +78,7 @@ impl<'a> TreeShaker<'a> { // Step 4: Generate output let codegen = CodeGenerator::new() .with_options(codegen_options.clone()) - .with_mangler(minifier_return.and_then(|r| r.mangler)); + .with_symbol_table(minifier_return.and_then(|r| r.symbol_table)); let codegen_return = codegen.build(ast); TreeShakeReturn { codegen_return, diagnostics: self.0.diagnostics.take() } diff --git a/crates/tree_shaker/src/utils/annotation.rs b/crates/tree_shaker/src/utils/annotation.rs index 68ae501a..efe4b522 100644 --- a/crates/tree_shaker/src/utils/annotation.rs +++ b/crates/tree_shaker/src/utils/annotation.rs @@ -1,7 +1,7 @@ use crate::analyzer::Analyzer; use oxc::{ast::CommentKind, span::Span}; -impl<'a> Analyzer<'a> { +impl Analyzer<'_> { fn has_annotation(&self, span: Span, test: fn(&str) -> bool) -> bool { let Some(comment) = self.semantic.comments_range(..span.start).next_back() else { return false; diff --git a/crates/tree_shaker/src/utils/ast.rs b/crates/tree_shaker/src/utils/ast.rs index b6d111e4..d77c4d5c 100644 --- a/crates/tree_shaker/src/utils/ast.rs +++ b/crates/tree_shaker/src/utils/ast.rs @@ -131,7 +131,7 @@ pub enum AstKind2<'a> { JSXAttributeName(&'a JSXAttributeName<'a>), } -impl<'a> GetSpan for AstKind2<'a> { +impl GetSpan for AstKind2<'_> { fn span(&self) -> Span { match self { AstKind2::Environment | AstKind2::Index(_) => SPAN, @@ -251,7 +251,7 @@ impl<'a> GetSpan for AstKind2<'a> { } } -impl<'a> fmt::Debug for AstKind2<'a> { +impl fmt::Debug for AstKind2<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.span().fmt(f) } diff --git a/crates/tree_shaker/src/utils/dep_id.rs b/crates/tree_shaker/src/utils/dep_id.rs index eca6d6f8..ae758f2a 100644 --- a/crates/tree_shaker/src/utils/dep_id.rs +++ b/crates/tree_shaker/src/utils/dep_id.rs @@ -30,15 +30,15 @@ impl<'a> From> for DepId { } } -impl<'a> From for AstKind2<'a> { +impl From for AstKind2<'_> { fn from(val: DepId) -> Self { unsafe { std::mem::transmute(val.0) } } } -impl<'a> GetSpan for DepId { +impl GetSpan for DepId { fn span(&self) -> Span { - let ast_kind: AstKind2<'a> = (*self).into(); + let ast_kind: AstKind2<'_> = (*self).into(); ast_kind.span() } } @@ -64,7 +64,7 @@ impl ReferredDeps { } } -impl<'a> Analyzer<'a> { +impl Analyzer<'_> { pub fn refer_dep(&mut self, dep: impl Into) { self.referred_deps.refer_dep(dep); } @@ -74,7 +74,7 @@ impl<'a> Analyzer<'a> { } } -impl<'a> Transformer<'a> { +impl Transformer<'_> { pub fn is_referred(&self, dep: impl Into) -> bool { self.referred_deps.is_referred(dep) } diff --git a/crates/tree_shaker/src/utils/function_name.rs b/crates/tree_shaker/src/utils/function_name.rs index 73db1dd7..b8a6615c 100644 --- a/crates/tree_shaker/src/utils/function_name.rs +++ b/crates/tree_shaker/src/utils/function_name.rs @@ -10,9 +10,9 @@ impl<'a> Analyzer<'a> { let node_id = self.semantic.scopes().get_node_id(scope_id); let parent = self.semantic.nodes().parent_kind(node_id)?; match parent { - AstKind::VariableDeclarator(node) => node.id.get_identifier().map(|a| a.as_str()), - AstKind::AssignmentPattern(node) => node.left.get_identifier().map(|a| a.as_str()), - AstKind::AssignmentExpression(node) => node.left.get_identifier(), + AstKind::VariableDeclarator(node) => node.id.get_identifier_name().map(|a| a.as_str()), + AstKind::AssignmentPattern(node) => node.left.get_identifier_name().map(|a| a.as_str()), + AstKind::AssignmentExpression(node) => node.left.get_identifier_name(), AstKind::ObjectProperty(node) => node.key.static_name().map(|s| { let kind_text = match node.kind { PropertyKind::Init => "", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index bbf217f2..5a09b9bb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.81.0" +channel = "1.84.1" profile = "default"

AltStyle によって変換されたページ (->オリジナル) /