Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 16, 2023
1 parent 9cd757e commit c731770
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/cjs_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl VisitMut for CjsOptimizer {
self.data.imports.insert(
key,
ImportRecord {
module_specifier: v.value.clone().into(),
module_specifier: v.value.clone(),
},
);
}
Expand Down
6 changes: 2 additions & 4 deletions packages/next-swc/crates/core/src/optimize_server_react.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Fold for OptimizeServerReact {
new_items.push(item.clone().fold_with(self));

if let ModuleItem::ModuleDecl(ModuleDecl::Import(import_decl)) = &item {
if import_decl.src.value.to_string() != "react" {
if import_decl.src.value != "react" {
continue;
}
for specifier in &import_decl.specifiers {
Expand Down Expand Up @@ -119,9 +119,7 @@ impl Fold for OptimizeServerReact {
if &f.to_id() == react_ident {
if let MemberProp::Ident(i) = &member.prop {
// Remove `React.useEffect` and `React.useLayoutEffect` calls
if i.sym.to_string() == "useEffect"
|| i.sym.to_string() == "useLayoutEffect"
{
if i.sym == "useEffect" || i.sym == "useLayoutEffect" {
return Expr::Lit(Lit::Null(Null { span: DUMMY_SP }));
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/next-swc/crates/core/src/page_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Fold for PageConfig {
for decl in &var_decl.decls {
let mut is_config = false;
if let Pat::Ident(ident) = &decl.name {
if &ident.id.sym == CONFIG_KEY {
if ident.id.sym == CONFIG_KEY {
is_config = true;
}
}
Expand Down Expand Up @@ -151,14 +151,14 @@ impl Fold for PageConfig {
match &specifier.exported {
Some(ident) => {
if let ModuleExportName::Ident(ident) = ident {
if &ident.sym == CONFIG_KEY {
if ident.sym == CONFIG_KEY {
self.handle_error("Config cannot be re-exported.", specifier.span)
}
}
}
None => {
if let ModuleExportName::Ident(ident) = &specifier.orig {
if &ident.sym == CONFIG_KEY {
if ident.sym == CONFIG_KEY {
self.handle_error("Config cannot be re-exported.", specifier.span)
}
}
Expand Down

0 comments on commit c731770

Please sign in to comment.