Skip to content

Commit a9c8c99

Browse files
Dunqingclaude
andcommitted
fix: resolve clippy warnings for CI
Use &Path instead of &PathBuf in bundle.rs, simplify redundant closure in code_cache.rs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 190363e commit a9c8c99

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/bundle.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//!
1515
//! This avoids any manual ESM→CJS string manipulation — rolldown does it all.
1616
17-
use std::path::{Path, PathBuf};
17+
use std::path::Path;
1818

1919
use crate::error::{Error, Result};
2020

@@ -62,7 +62,7 @@ pub fn bundle(entry: &Path) -> Result<Vec<u8>> {
6262
/// Pass 1: ESM bundle → single file with only external imports remaining.
6363
/// Wrap: Move `await` into an async IIFE so it's no longer top-level.
6464
/// Pass 2: CJS bundle → rolldown converts imports, polyfills import.meta, etc.
65-
async fn two_pass_bundle(entry: &str, cwd: &PathBuf) -> Result<Vec<u8>> {
65+
async fn two_pass_bundle(entry: &str, cwd: &Path) -> Result<Vec<u8>> {
6666
// Pass 1: Bundle as ESM (TLA is allowed).
6767
let esm_code = try_bundle(entry, cwd, rolldown::OutputFormat::Esm)
6868
.await
@@ -86,7 +86,7 @@ async fn two_pass_bundle(entry: &str, cwd: &PathBuf) -> Result<Vec<u8>> {
8686
// No TLA error because `await` is now inside a function.
8787
let cjs_code = try_bundle(
8888
"./__nodesea_bundle.mjs",
89-
&tmp_dir.path().to_path_buf(),
89+
tmp_dir.path(),
9090
rolldown::OutputFormat::Cjs,
9191
)
9292
.await
@@ -187,12 +187,12 @@ fn build_define_map() -> rolldown_utils::indexmap::FxIndexMap<String, String> {
187187
/// Run rolldown with the given output format and return the entry chunk code.
188188
async fn try_bundle(
189189
entry: &str,
190-
cwd: &PathBuf,
190+
cwd: &Path,
191191
format: rolldown::OutputFormat,
192192
) -> std::result::Result<Vec<u8>, String> {
193193
let mut bundler = rolldown::Bundler::new(rolldown::BundlerOptions {
194194
input: Some(vec![entry.to_string().into()]),
195-
cwd: Some(cwd.clone()),
195+
cwd: Some(cwd.to_path_buf()),
196196
platform: Some(rolldown::Platform::Node),
197197
format: Some(format),
198198
code_splitting: Some(rolldown_common::CodeSplittingMode::Bool(false)),

src/code_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ process.stdout.write(compiled.cachedData);
4343
.arg(&source_file)
4444
.arg(code_path)
4545
.output()
46-
.map_err(|e| Error::Io(e))?;
46+
.map_err(Error::Io)?;
4747

4848
if !output.status.success() {
4949
let stderr = String::from_utf8_lossy(&output.stderr);

0 commit comments

Comments
 (0)