Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/node_binding/src/dependencies/entry_dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ impl EntryDependency {
match &self.dependency_id {
Some(dependency_id) => {
Err(napi::Error::from_reason(format!(
"Dependency with id = {:?} has already been resolved. Reusing EntryDependency is not allowed because Rust requires its ownership.",
dependency_id
"Dependency with id = {dependency_id:?} has already been resolved. Reusing EntryDependency is not allowed because Rust requires its ownership."
)))
}
None => {
Expand Down
2 changes: 1 addition & 1 deletion crates/node_binding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ fn init() {
.thread_name_fn(|| {
static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0);
let id = ATOMIC_ID.fetch_add(1, Ordering::SeqCst);
format!("tokio-{}", id)
format!("tokio-{id}")
})
.enable_all()
.build()
Expand Down
2 changes: 1 addition & 1 deletion crates/node_binding/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn install_panic_handler() {
{
use rspack_core::debug_info::DEBUG_INFO;
if let Ok(info) = DEBUG_INFO.lock() {
eprintln!("{}", info);
eprintln!("{info}");
}
}
panic_handler(panic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl From<RawLazyCompilationTest> for LazyCompilationTest<LazyCompilationTestFn>
match value.0 {
Either::A(regex) => Self::Regex(
RspackRegex::with_flags(&regex.source, &regex.flags).unwrap_or_else(|_| {
let msg = format!("[lazyCompilation]incorrect regex {:?}", regex);
let msg = format!("[lazyCompilation]incorrect regex {regex:?}");
panic!("{msg}");
}),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl TryFrom<RawLightningCssMinimizerRspackPluginOptions> for PluginOptions {
.targets
.map(browserslist_to_lightningcss_targets)
.transpose()
.to_rspack_result_with_message(|e| format!("Failed to parse browserslist: {}", e))?
.to_rspack_result_with_message(|e| format!("Failed to parse browserslist: {e}"))?
.flatten(),
include: value.minimizer_options.include,
exclude: value.minimizer_options.exclude,
Expand Down
8 changes: 4 additions & 4 deletions crates/node_binding/src/raw_options/raw_module/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ pub enum RawRuleSetCondition {
impl Debug for RawRuleSetCondition {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
RawRuleSetCondition::string(s) => write!(f, "RawRuleSetCondition::string({:?})", s),
RawRuleSetCondition::regexp(r) => write!(f, "RawRuleSetCondition::regexp({:?})", r),
RawRuleSetCondition::logical(l) => write!(f, "RawRuleSetCondition::logical({:?})", l),
RawRuleSetCondition::array(a) => write!(f, "RawRuleSetCondition::array({:?})", a),
RawRuleSetCondition::string(s) => write!(f, "RawRuleSetCondition::string({s:?})"),
RawRuleSetCondition::regexp(r) => write!(f, "RawRuleSetCondition::regexp({r:?})"),
RawRuleSetCondition::logical(l) => write!(f, "RawRuleSetCondition::logical({l:?})"),
RawRuleSetCondition::array(a) => write!(f, "RawRuleSetCondition::array({a:?})"),
RawRuleSetCondition::func(_) => write!(f, "RawRuleSetCondition::func(...)"),
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/node_binding/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl JsResolver {
Ok(Either::A(ResourceData::from(resource).into()))
}
Ok(rspack_core::ResolveResult::Ignored) => Ok(Either::B(false)),
Err(err) => Err(napi::Error::from_reason(format!("{:?}", err))),
Err(err) => Err(napi::Error::from_reason(format!("{err:?}"))),
}
})
}
Expand All @@ -74,7 +74,7 @@ impl JsResolver {
Either::<JsResourceData, bool>::A(ResourceData::from(resource).into()),
),
Ok(rspack_core::ResolveResult::Ignored) => Ok(Either::B(false)),
Err(err) => Err(napi::Error::from_reason(format!("{:?}", err))),
Err(err) => Err(napi::Error::from_reason(format!("{err:?}"))),
}
},
|| {},
Expand Down
2 changes: 1 addition & 1 deletion crates/node_binding/src/resolver_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl JsResolverFactory {
Ok(JsResolver::new(resolver_factory, options))
}
_ => {
Err(napi::Error::from_reason(format!("Invalid resolver type '{}' specified. Rspack only supports 'normal', 'context', and 'loader' types.", r#type)))
Err(napi::Error::from_reason(format!("Invalid resolver type '{type}' specified. Rspack only supports 'normal', 'context', and 'loader' types.")))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/node_binding/src/swc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub async fn transform(source: String, options: String) -> napi::Result<Transfor
|_| noop_pass(),
)
.map(TransformOutput::from)
.map_err(|e| napi::Error::new(napi::Status::GenericFailure, format!("{}", e)))
.map_err(|e| napi::Error::new(napi::Status::GenericFailure, format!("{e}")))
}

#[napi]
Expand All @@ -55,7 +55,7 @@ pub async fn minify(source: String, options: String) -> napi::Result<TransformOu
let v = e.into_inner();
let err = v
.into_iter()
.map(|e| format!("{:?}", e))
.map(|e| format!("{e:?}"))
.collect::<Vec<_>>()
.join("\n");

Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_cacheable/src/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl std::fmt::Display for DeserializeError {
match self {
Self::BoxedError(error) => error.fmt(f),
Self::MessageError(msg) => {
write!(f, "{}", msg)
write!(f, "{msg}")
}
Self::DynCheckBytesNotRegister => {
write!(f, "cacheable_dyn check bytes not register")
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_cacheable/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl std::fmt::Display for SerializeError {
match self {
Self::BoxedError(error) => error.fmt(f),
Self::MessageError(msg) => {
write!(f, "{}", msg)
write!(f, "{msg}")
}
Self::NoContext => {
write!(f, "no context")
Expand Down
3 changes: 2 additions & 1 deletion crates/rspack_core/src/exports/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ impl DependencyConditionFn for UsedByExportsDependencyCondition {
.expect("should have parent module");
let exports_info = mg.get_exports_info(module_identifier);
for export_name in self.used_by_exports.iter() {
if exports_info.get_used(mg, &[export_name.clone()], runtime) != UsageState::Unused {
if exports_info.get_used(mg, std::slice::from_ref(export_name), runtime) != UsageState::Unused
{
return ConnectionState::Active(true);
}
}
Expand Down
8 changes: 3 additions & 5 deletions crates/rspack_core/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,9 @@ which tries to resolve these kind of requests in the current directory too.",
Err(_) => normalized_path.parent(),
};

if file_name.is_some() && parent_path.is_some() {
let file_name = file_name.expect("fail to get the filename of the current resolved module");
let parent_path =
parent_path.expect("fail to get the parent path of the current resolved module");

if let Some(file_name) = file_name
&& let Some(parent_path) = parent_path
{
// read the files in the parent directory
if let Ok(files) = fs::read_dir(parent_path) {
let mut requested_names = vec![file_name
Expand Down
14 changes: 7 additions & 7 deletions crates/rspack_error/src/graphical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl GraphicalReportHandler {
if self.links == LinkStyle::Link && diagnostic.url().is_some() {
let url = diagnostic.url().unwrap(); // safe
let code = if let Some(code) = diagnostic.code() {
format!("{} ", code)
format!("{code} ")
} else {
"".to_string()
};
Expand All @@ -193,16 +193,16 @@ impl GraphicalReportHandler {
code.style(severity_style),
"(link)".style(self.theme.styles.link)
);
write!(header, "{}", link)?;
writeln!(f, "{}", header)?;
write!(header, "{link}")?;
writeln!(f, "{header}")?;
writeln!(f)?;
} else if let Some(code) = diagnostic.code() {
write!(header, "{}", code.style(severity_style),)?;
if self.links == LinkStyle::Text && diagnostic.url().is_some() {
let url = diagnostic.url().unwrap(); // safe
write!(header, " ({})", url.style(self.theme.styles.link))?;
}
writeln!(f, "{}", header)?;
writeln!(f, "{header}")?;
writeln!(f)?;
}
Ok(())
Expand Down Expand Up @@ -443,11 +443,11 @@ impl GraphicalReportHandler {

if let Some(source_name) = contents.name() {
let source_name = source_name.style(self.theme.styles.link);
writeln!(f, "[{}:{}:{}]", source_name, source_line, source_col)?;
writeln!(f, "[{source_name}:{source_line}:{source_col}]")?;
} else if lines.len() <= 1 {
writeln!(f, "{}", self.theme.characters.hbar.to_string().repeat(3))?;
} else {
writeln!(f, "[{}:{}]", source_line, source_col)?;
writeln!(f, "[{source_line}:{source_col}]")?;
}

// Now it's time for the fun part--actually rendering everything!
Expand Down Expand Up @@ -722,7 +722,7 @@ impl GraphicalReportHandler {
(hl, vbar_offset)
})
.collect();
writeln!(f, "{}", underlines)?;
writeln!(f, "{underlines}")?;

for hl in single_liners.iter().rev() {
if let Some(label) = hl.label() {
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_ids/src/id_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pub fn get_short_chunk_name(
.map(|id| {
module_graph
.module_by_identifier(id)
.unwrap_or_else(|| panic!("Module not found {}", id))
.unwrap_or_else(|| panic!("Module not found {id}"))
})
.collect::<Vec<_>>();
let short_module_names = modules
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_loader_lightningcss/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl TryFrom<RawConfig> for Config {
.targets
.map(browserslist_to_lightningcss_targets)
.transpose()
.to_rspack_result_with_message(|e| format!("Failed to parse browserslist: {}", e))?
.to_rspack_result_with_message(|e| format!("Failed to parse browserslist: {e}"))?
.flatten(),
include: value.include,
exclude: value.exclude,
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_macros/src/cacheable_dyn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn impl_impl(mut input: ItemImpl) -> TokenStream {
panic!("cacheable_dyn unsupported this target")
}
};
let archived_target_ident = Ident::new(&format!("Archived{}", target_ident_str), input.span());
let archived_target_ident = Ident::new(&format!("Archived{target_ident_str}"), input.span());
#[allow(clippy::disallowed_methods)]
let dyn_id_ident = Ident::new(
&format!(
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_macros/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn expand_struct(mut input: syn::ItemStruct) -> proc_macro::TokenStream {
}

fn plugin_inner_ident(ident: &syn::Ident) -> syn::Ident {
let inner_name = format!("{}Inner", ident);
let inner_name = format!("{ident}Inner");
syn::Ident::new(&inner_name, ident.span())
}

Expand Down
4 changes: 2 additions & 2 deletions crates/rspack_napi_macros/src/tagged_union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn expand(tokens: TokenStream) -> TokenStream {
})
.collect::<Vec<TokenStream>>();

let union_type_name = Ident::new(&format!("{}Type", original_name), Span::call_site());
let union_type_name = Ident::new(&format!("{original_name}Type"), Span::call_site());

let as_str_impl = {
let arms = field_idents
Expand Down Expand Up @@ -140,6 +140,6 @@ pub fn expand(tokens: TokenStream) -> TokenStream {
}

fn get_intermediate_ident(name: &str) -> Ident {
let new_name = format!("__rspack_napi__{}", name);
let new_name = format!("__rspack_napi__{name}");
Ident::new(&new_name, Span::call_site())
}
2 changes: 1 addition & 1 deletion crates/rspack_plugin_banner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn wrap_comment(str: &str) -> String {
let result = TRIALING_WHITESPACE.replace_all(&result, "\n");
let result = result.trim_end();

format!("/*!\n * {}\n */", result)
format!("/*!\n * {result}\n */")
}

#[plugin]
Expand Down
Loading
Loading