rust-clippy

(★ 13,460)

일반적인 실수를 방지하고 Rust 코드를 개선하기 위한 다양한 린트 모음입니다. 책: https://doc.rust-lang.org/clippy/

파일 탐색기

파일 수가 많아 일부만 표시됩니다. 전체 파일은 위 다운로드 버튼으로 확인해 주세요.

  • .editorconfig
  • .gitattributes
  • .gitignore
  • .remarkrc
  • askama.toml
  • build.rs
  • Cargo.toml
  • CHANGELOG.md
  • clippy.toml
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • COPYRIGHT
  • LICENSE-APACHE
  • LICENSE-MIT
  • README.md
  • rust-toolchain.toml
  • rustfmt.toml

# 설치 가이드

rust
사전 준비물

설치 및 실행 절차

rustup update

Rustup 및 최신 컴파일러를 최신 버전으로 업데이트합니다.

rustup component add clippy

rustup을 통해 clippy 컴포넌트를 설치합니다.

cargo clippy

프로젝트에서 Clippy 린트를 실행합니다.

핵심 명령어

cargo clippy

현재 Cargo 프로젝트의 코드를 분석하고 린트 경고를 출력합니다.

cargo clippy --fix

Clippy의 수정 제안을 소스 코드에 자동으로 적용합니다.

cargo clippy -p example

워크스페이스 내 특정 패키지에 대해서만 Clippy를 실행합니다.

clippy-driver --edition 2018 -Cpanic=abort foo.rs

Cargo를 사용하지 않는 프로젝트에서 rustc 대신 직접 Clippy를 구동합니다.

경고를 에러로 처리하려면 CARGO_BUILD_WARNINGS=deny 환경변수를 활용할 수 있습니다.

# CDN으로 사용하기

jsDelivr

jsDelivr는 공개 GitHub 리포지토리를 별도 설정 없이 CDN으로 즉시 서빙합니다. 버전과 파일을 고르면 웹페이지에 바로 붙일 수 있는 링크와 예시 코드가 만들어집니다.

파일 목록이 많아 일부만 표시됩니다.

명령어 용어집

이 문서에서 사용된 명령어를 모아봤습니다. 낯선 명령어가 있다면 펼쳐서 확인해보세요.

🔍

cargo check

설명 보기 ▼

Check a local package and all of its dependencies for errors.

cargo {{[c|check]}}

Check the current package:

cargo {{[c|check]}} --tests

Check all tests:

cargo {{[c|check]}} --test {{integration_test1}}

Check the integration tests in `tests/integration_test1.rs`:

🔍

cargo clippy

설명 보기 ▼

A collection of lints to catch common mistakes and improve your Rust code.

cargo clippy

Run checks over the code in the current directory:

cargo clippy --locked

Require that `Cargo.lock` is up to date:

cargo clippy --workspace

Run checks on all packages in the workspace:

🔍

rustc

설명 보기 ▼

Rust 컴파일러.
Rust 프로젝트는 보통 `rustc`를 직접 호출하는 대신 `cargo`를 사용합니다.
더 많은 정보: <https://doc.rust-lang.org/stable/rustc/>.

rustc {{path/to/main.rs}}

바이너리 크레이트 컴파일:

rustc {{[-C|--codegen]}} lto {{[-C|--codegen]}} opt-level={{0|1|2|3|s|z}} {{path/to/main.rs}}

최적화하여 컴파일 (`s`는 바이너리 크기 최적화를 의미하며, `z`는 더 많은 최적화를 포함):

rustc {{[-g|--codegen debuginfo=2]}} {{path/to/main.rs}}

디버깅 정보 포함하여 컴파일:

🔍

rustup component

설명 보기 ▼

Modify a toolchain's installed components.
Without the `--toolchain` option `rustup` will use the default toolchain. See `rustup help toolchain` for more information about toolchains.

rustup component add --toolchain {{toolchain}} {{component}}

Add a component to a toolchain:

rustup component remove --toolchain {{toolchain}} {{component}}

Remove a component from a toolchain:

rustup component list --toolchain {{toolchain}}

List installed and available components for a toolchain:

🔍

rustup self

설명 보기 ▼

Modify the `rustup` installation.

rustup self update

Update `rustup`:

rustup self uninstall

Uninstall `rustup`:

🔍

rustup update

설명 보기 ▼

Update Rust toolchains and `rustup` itself (if not installed using a package manager).

rustup update

Update all installed toolchains and `rustup`:

rustup update {{toolchain}}

Install or update a specific toolchain (see `rustup help toolchain` for more information):

# 프로젝트 배지

// repository documentation