문서 보기이전 판역링크맨 위로 이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요. {{tag>[cli rust clippy lint static-analysis]}} ====== Clippy / cargo clippy ====== 일반적인 실수, 의심스러운 code, style, complexity, performance 문제를 검사하는 official Rust lint component. ===== Installation ===== rustup의 default profile에는 보통 포함된다. 빠져 있다면 현재 toolchain에 component를 추가한다. <code bash> rustup component add clippy cargo clippy --version </code> ===== Usage ===== <code bash> cargo clippy [cargo-options] [-- lint-options] </code> * ''<color #c3c3c3>**cargo**</color> <color #ff7f27>clippy</color> <color #22b14c>[cargo-options...]</color> <color #7092be>[-- lint-options...]</color>'' ===== Examples ===== <code bash> cargo clippy cargo clippy --all-targets --all-features cargo clippy --workspace --all-targets --all-features -- -D warnings cargo clippy --fix --allow-dirty --allow-staged cargo clippy -- -W clippy::pedantic </code> ===== Lint Groups ===== * ''clippy::correctness'': 명백히 잘못되거나 쓸모없는 code. 기본 deny. * ''clippy::suspicious'', ''clippy::style'', ''clippy::complexity'', ''clippy::perf'': 기본 lint set의 주요 그룹. * ''clippy::pedantic'': 더 엄격하며 false positive 가능성이 있어 선택적으로 적용. * ''clippy::nursery'': 개발 중인 lint이므로 version 변화 가능성을 고려. * ''clippy::cargo'': ''Cargo.toml'' 관련 lint. * ''clippy::restriction'': 서로 충돌하거나 일반 code를 과도하게 제한할 수 있어 전체 그룹 활성화를 피하고 개별 lint를 선택한다. ===== CI ===== <code bash> cargo clippy --workspace --all-targets --all-features -- -D warnings </code> <note important> ''-D warnings''는 compiler version이 올라가 새 lint가 추가될 때 기존 code의 CI를 깨뜨릴 수 있다. toolchain pinning과 update 정책을 함께 운영한다. </note> ===== Fixes ===== ''cargo clippy --fix''는 source를 수정할 수 있다. clean working tree에서 diff를 검토하며 실행하고, staged 또는 dirty file 허용 flag는 의도를 확인한 경우에만 사용한다. ===== Troubleshooting ===== * macro expansion이나 generated code의 false positive는 lint를 전역으로 끄기 전에 가장 좁은 scope의 ''#[allow(...)]''와 근거 comment를 검토한다. * workspace package별 feature 차이는 실제 release 조합과 ''--all-features'' 결과를 모두 확인한다. * nightly toolchain에서 component가 unavailable이면 compatible nightly date를 선택하거나 stable Clippy를 사용한다. ===== Help ===== +++ cargo clippy --help | <code text> 로컬 실행 파일이 없어 live output을 수집하지 않았다. cargo clippy --help rustc -W help </code> +++ ===== See Also ===== * [[rust:ko]] * [[rust:cargo:ko]] * [[rust:rustfmt:ko]] * [[https://doc.rust-lang.org/clippy/|Clippy Documentation]] ===== History ===== * codex:: 2026-07-20 Added Clippy lint groups, CI policy, automatic fix safety, and troubleshooting guidance. {{indexmenu>.#1|js}} /home/u613600155/domains/cli.zerotymer.net/public_html/data/pages/rust/clippy/ko.txt 마지막으로 수정됨: 2026/07/20 13:12저자 127.0.0.1