1- use std:: collections:: { HashMap , HashSet } ;
21use std:: path:: PathBuf ;
32use std:: sync:: mpsc:: Sender ;
43use std:: sync:: Arc ;
54use std:: time:: Instant ;
65
76use cached:: proc_macro:: cached;
87use mako_core:: anyhow:: { anyhow, Result } ;
8+ use mako_core:: collections:: { HashMap , HashSet } ;
99use mako_core:: colored:: Colorize ;
1010use mako_core:: lazy_static:: lazy_static;
1111use mako_core:: rayon:: ThreadPool ;
@@ -82,7 +82,7 @@ impl Compiler {
8282 pub fn build_tasks ( & self , tasks : Vec < Task > , with_cache : bool ) -> Result < HashSet < ModuleId > > {
8383 debug ! ( "build tasks: {:?}" , tasks) ;
8484 if tasks. is_empty ( ) {
85- return Ok ( HashSet :: new ( ) ) ;
85+ return Ok ( HashSet :: default ( ) ) ;
8686 }
8787
8888 let ( pool, rs, rr) = create_thread_pool :: < Result < ( Module , ModuleDeps , Task ) > > ( ) ;
@@ -99,7 +99,7 @@ impl Compiler {
9999 }
100100
101101 let mut errors = vec ! [ ] ;
102- let mut module_ids = HashSet :: new ( ) ;
102+ let mut module_ids = HashSet :: default ( ) ;
103103 for r in rr {
104104 count -= 1 ;
105105 match r {
@@ -279,7 +279,7 @@ module.exports = new Promise((resolve, reject) => {{
279279 raw : code,
280280 raw_hash : 0 ,
281281 resolved_resource : Some ( resource. clone ( ) ) ,
282- missing_deps : HashMap :: new ( ) ,
282+ missing_deps : HashMap :: default ( ) ,
283283 ignored_deps : vec ! [ ] ,
284284 top_level_await : false ,
285285 is_async : has_script,
@@ -342,7 +342,7 @@ module.exports = new Promise((resolve, reject) => {{
342342 // resolve
343343 let mut dep_resolve_err = None ;
344344 let mut dependencies_resource = Vec :: new ( ) ;
345- let mut missing_deps = HashMap :: new ( ) ;
345+ let mut missing_deps = HashMap :: default ( ) ;
346346 let mut ignored_deps = Vec :: new ( ) ;
347347
348348 for dep in deps {
@@ -370,7 +370,7 @@ module.exports = new Promise((resolve, reject) => {{
370370 let source = e. 1 ;
371371 let span = e. 3 ;
372372 // 使用 hasMap 记录循环依赖
373- let mut target_map: HashMap < String , i32 > = HashMap :: new ( ) ;
373+ let mut target_map: HashMap < String , i32 > = HashMap :: default ( ) ;
374374 target_map. insert ( target, 1 ) ;
375375
376376 let mut err = format ! ( "Module not found: Can't resolve '{}'" , source) ;
0 commit comments