diff --git a/Cargo.toml b/Cargo.toml index 09834d26a85..33d5ef566d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,7 +132,8 @@ flat_map_option = "warn" fn_params_excessive_bools = "warn" from_iter_instead_of_collect = "warn" implicit_clone = "warn" -implicit_hasher = "warn" +# not sure whether it's necessary +# implicit_hasher = "warn" index_refutable_slice = "warn" inefficient_to_string = "warn" invalid_upcast_comparisons = "warn" diff --git a/crates/rspack_core/src/compiler/compilation.rs b/crates/rspack_core/src/compiler/compilation.rs index 41a3fce8b43..618dddc08ad 100644 --- a/crates/rspack_core/src/compiler/compilation.rs +++ b/crates/rspack_core/src/compiler/compilation.rs @@ -1288,7 +1288,7 @@ impl Compilation { let entrypoint = self.chunk_group_by_ukey.expect_get(entrypoint_ukey); entrypoint.get_runtime_chunk(&self.chunk_group_by_ukey) }); - UkeySet::from_iter(entries.chain(async_entries)) + entries.chain(async_entries).collect() } #[allow(clippy::unwrap_in_result)] diff --git a/crates/rspack_core/src/compiler/make/repair/factorize.rs b/crates/rspack_core/src/compiler/make/repair/factorize.rs index 6ea6e013daa..a6d5eae5b03 100644 --- a/crates/rspack_core/src/compiler/make/repair/factorize.rs +++ b/crates/rspack_core/src/compiler/make/repair/factorize.rs @@ -204,7 +204,6 @@ impl Task for FactorizeResultTask { context_dependencies, missing_dependencies, diagnostics, - .. } = *self; let artifact = &mut context.artifact; if !diagnostics.is_empty() { diff --git a/crates/rspack_core/src/concatenated_module.rs b/crates/rspack_core/src/concatenated_module.rs index 2a7f71e92c9..2ae5fe99234 100644 --- a/crates/rspack_core/src/concatenated_module.rs +++ b/crates/rspack_core/src/concatenated_module.rs @@ -7,7 +7,7 @@ use std::{ }; use dashmap::DashMap; -use indexmap::{IndexMap, IndexSet}; +use indexmap::IndexMap; use rayon::prelude::*; use regex::Regex; use rspack_ast::javascript::Ast; @@ -656,7 +656,7 @@ impl Module for ConcatenatedModule { module_to_info_map.insert(id, module_info); } - let mut all_used_names = HashSet::from_iter(RESERVED_NAMES.iter().map(|s| Atom::new(*s))); + let mut all_used_names: HashSet = RESERVED_NAMES.iter().map(|s| Atom::new(*s)).collect(); let mut top_level_declarations: HashSet = HashSet::default(); for module_info_id in modules_with_info.iter() { @@ -1042,10 +1042,10 @@ impl Module for ConcatenatedModule { for module_info_id in needed_namespace_objects.clone().iter() { if visited.contains(module_info_id) { continue; - } else { - visited.insert(*module_info_id); - changed = true; } + visited.insert(*module_info_id); + changed = true; + let module_info = module_to_info_map .get(module_info_id) .map(|m| m.as_concatenated()) @@ -1301,7 +1301,7 @@ impl Module for ConcatenatedModule { let runtime = runtime.as_deref(); for info in self.create_concatenation_list( self.root_module_ctxt.id, - IndexSet::from_iter(self.modules.iter().map(|item| item.id)), + self.modules.iter().map(|item| item.id).collect(), runtime, &compilation.get_module_graph(), ) { @@ -1417,7 +1417,7 @@ impl ConcatenatedModule { ) -> (Vec, IdentifierIndexMap) { let ordered_concatenation_list = self.create_concatenation_list( self.root_module_ctxt.id, - IndexSet::from_iter(self.modules.iter().map(|item| item.id)), + self.modules.iter().map(|item| item.id).collect(), runtime, mg, ); diff --git a/crates/rspack_core/src/options/resolve/mod.rs b/crates/rspack_core/src/options/resolve/mod.rs index e3b227fcb6d..a5d0798a313 100644 --- a/crates/rspack_core/src/options/resolve/mod.rs +++ b/crates/rspack_core/src/options/resolve/mod.rs @@ -82,7 +82,7 @@ pub struct Resolve { /// Configure resolve options by the type of module request. pub by_dependency: Option, /// The JSON files to use for descriptions - /// Default is ["package.json"] + /// Default is [`package.json`] pub description_files: Option, /// If enforce_extension is set to EnforceExtension::Enabled, resolution will not allow extension-less files. This means require('./foo.js') will resolve, while require('./foo') will not. pub enforce_extension: Option, diff --git a/crates/rspack_core/src/stats/mod.rs b/crates/rspack_core/src/stats/mod.rs index 5260294ca71..f147d0fbcc1 100644 --- a/crates/rspack_core/src/stats/mod.rs +++ b/crates/rspack_core/src/stats/mod.rs @@ -273,7 +273,7 @@ impl Stats<'_> { .into_iter() .collect::(); - let mut auxiliary_files = Vec::from_iter(c.auxiliary_files.iter().cloned()); + let mut auxiliary_files = c.auxiliary_files.iter().cloned().collect::>(); auxiliary_files.sort_unstable(); let chunk_modules = if options.chunk_modules {