Skip to content

Commit

Permalink
chore: fix clippy rule
Browse files Browse the repository at this point in the history
  • Loading branch information
hardfist committed Aug 16, 2024
1 parent e5ca7bc commit c277516
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_core/src/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 0 additions & 1 deletion crates/rspack_core/src/compiler/make/repair/factorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ impl Task<MakeTaskContext> for FactorizeResultTask {
context_dependencies,
missing_dependencies,
diagnostics,
..
} = *self;
let artifact = &mut context.artifact;
if !diagnostics.is_empty() {
Expand Down
14 changes: 7 additions & 7 deletions crates/rspack_core/src/concatenated_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Atom> = RESERVED_NAMES.iter().map(|s| Atom::new(*s)).collect();
let mut top_level_declarations: HashSet<Atom> = HashSet::default();

for module_info_id in modules_with_info.iter() {
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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(),
) {
Expand Down Expand Up @@ -1417,7 +1417,7 @@ impl ConcatenatedModule {
) -> (Vec<ModuleIdentifier>, IdentifierIndexMap<ModuleInfo>) {
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,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_core/src/options/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub struct Resolve {
/// Configure resolve options by the type of module request.
pub by_dependency: Option<ByDependency>,
/// The JSON files to use for descriptions
/// Default is ["package.json"]
/// Default is [`package.json`]
pub description_files: Option<DescriptionFiles>,
/// 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<EnforceExtension>,
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_core/src/stats/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ impl Stats<'_> {
.into_iter()
.collect::<IdentifierSet>();

let mut auxiliary_files = Vec::from_iter(c.auxiliary_files.iter().cloned());
let mut auxiliary_files = c.auxiliary_files.iter().cloned().collect::<Vec<_>>();
auxiliary_files.sort_unstable();

let chunk_modules = if options.chunk_modules {
Expand Down

0 comments on commit c277516

Please sign in to comment.