Conversation
build コマンドと同じフォーマット「build finished in {} ms」で
処理時間を表示するようにした。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @zztkm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! このプルリクエストは、 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
src/subcommand_serve.rs
Outdated
| let start = std::time::Instant::now(); | ||
| if let Err(e) = subcommand_build::run_build(&config_path_clone) { | ||
| eprintln!("[ERROR] Rebuild failed: {:#}", e); | ||
| } else { | ||
| let duration = start.elapsed(); | ||
| println!("[INFO] Rebuild completed"); | ||
| println!("build finished in {} ms", duration.as_millis()); | ||
| } |
There was a problem hiding this comment.
ビルド時間を計測するロジックが run_serve 関数(65-69行目)と watch_files 関数で重複しています。
このロジックをヘルパー関数に切り出すことで、コードの重複をなくし、保守性を向上させることができます。
例えば、以下のようなヘルパー関数を subcommand_serve.rs 内に定義します。
fn run_build_with_timing(config_path: &Path) -> Result<Duration> {
let start = Instant::now();
subcommand_build::run_build(config_path)?;
Ok(start.elapsed())
}このヘルパー関数を使うと、ここの処理は以下のように書き換えられます。
run_serve 関数内の同様の処理もこのヘルパー関数を使って書き換えることを推奨します。
加えて、Instant はファイルの先頭で use されているため、std::time::Instant のようにフルパスで指定する必要はありません。このリファクタリングで合わせて修正されます。
match run_build_with_timing(&config_path_clone) {
Ok(duration) => {
println!("[INFO] Rebuild completed");
println!("build finished in {} ms", duration.as_millis());
}
Err(e) => {
eprintln!("[ERROR] Rebuild failed: {:#}", e);
}
}レビュー指摘対応:run_build_with_timing 関数を追加し、 初回ビルドと再ビルドで重複していたロジックを共通化した。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
serveコマンドの初回ビルドと再ビルド(ファイル変更検知時)で処理時間を表示buildコマンドと同じフォーマット「build finished in {} ms」を使用出力例
Test plan
cargo buildでビルド成功を確認cargo run -- serveを実行し、初回ビルドの処理時間が表示されることを確認🤖 Generated with Claude Code