スキル一覧に戻る
forrestthewoods

rust-cargo-check

by forrestthewoods

0🍴 0📅 2026年1月25日
GitHubで見るManusで実行

SKILL.md


name: rust-cargo-check description: Prefer cargo check over cargo build when making Rust code changes. Use cargo check to quickly verify code compiles; only use cargo build when you need to run the executable.

Rust: Prefer cargo check Over cargo build

Key Principle

When working with Rust code, use cargo check to verify code compiles. Only use cargo build when you actually need to run the resulting executable.

Why cargo check is Preferred

CommandWhat it doesSpeed
cargo checkType-checks and validates code compilesFast
cargo buildFull compilation + produces executableSlow

cargo check skips the code generation and linking phases, making it significantly faster than cargo build - often 2-5x faster or more.

When to Use Each Command

Use cargo check when:

  • Making code changes and verifying they compile
  • Iterating on fixes for compiler errors
  • Refactoring code
  • Adding new functions, structs, or modules
  • Fixing type errors
  • Any time you just need to know "does this compile?"
# Quick compilation check
cargo check

# Check with all features
cargo check --all-features

# Check in release mode (catches some additional warnings)
cargo check --release

Use cargo build when:

  • You need to run the executable afterward
  • You're about to execute cargo run
  • You need to test the actual binary output
  • You're preparing a release artifact
# Build and run
cargo build --release && ./target/release/myapp

# Or just use cargo run (which builds implicitly)
cargo run --release -- <args>

Workflow Example

Fixing a Compile Error

# 1. Make code changes to fix the error

# 2. Quick check - does it compile?
cargo check

# 3. If errors remain, fix and check again
cargo check

# 4. Once it compiles, run tests
cargo test

# 5. Only build if you need to run the binary
cargo build --release

Iterating on Code Changes

# Edit code...
cargo check    # Fast feedback

# Edit more...
cargo check    # Fast feedback

# Edit more...
cargo check    # Fast feedback

# Ready to test the actual program
cargo run --release -- <args>

Common Patterns

After Editing Rust Files

# DO: Quick compile check
cargo check

# DON'T: Slow full build just to check compilation
cargo build

Before Running Tests

# Tests compile the code anyway, so just run them directly
cargo test

# No need to cargo build first

When You Need to Run the Binary

# cargo run builds automatically, so use it directly
cargo run --release -- build -m //mode:win_dev -t //target:name

# Or build then run separately if you prefer
cargo build --release
./target/release/anubis build -m //mode:win_dev -t //target:name

Summary

SituationCommand
Check if code compilescargo check
Run testscargo test
Run the programcargo run
Build for distributioncargo build --release
Iterate on fixescargo check (repeatedly)

Default to cargo check - it's your fast feedback loop for Rust development.

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です