From fac1ea76f76158c7d85d8b8d544518e3ca9c38b8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 20 Jan 2024 03:24:36 +0000 Subject: [PATCH] doc: update contrib docs --- _contrib/code-style.md | 26 ++++++++++++++++++++++++++ _contrib/contributing.md | 19 ------------------- 2 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 _contrib/code-style.md diff --git a/_contrib/code-style.md b/_contrib/code-style.md new file mode 100644 index 0000000..cc544f3 --- /dev/null +++ b/_contrib/code-style.md @@ -0,0 +1,26 @@ +--- +title: Code Style +layout: guide +hyper_path: docs/CODE_STYLE.md +--- + +hyper uses the default configuration of `rustfmt`. + +## cargo fmt + +`cargo fmt --all` does not work in hyper. Please use the following commands: + +```txt +# Mac or Linux +rustfmt --check --edition 2018 $(git ls-files '*.rs') + +# Powershell +Get-ChildItem . -Filter "*.rs" -Recurse | foreach { rustfmt --check --edition 2018 $_.FullName } +``` + +> **NOTE**: If you are using `rust-analyzer`, you can add the following two lines in your `settings.json` to make sure the features get taken into account when checking the project: +> +> ```json +> "rust-analyzer.cargo.features": ["full"], +> "rust-analyzer.check.features": ["full"], +> ``` diff --git a/_contrib/contributing.md b/_contrib/contributing.md index 1086e26..e478b4d 100644 --- a/_contrib/contributing.md +++ b/_contrib/contributing.md @@ -12,22 +12,3 @@ You want to contribute? You're awesome! Don't know where to start? Check the [li - [Submitting a Pull Request](pull-requests.md#submitting-a-pull-request) - [Commit Guidelines](commits.md) - -## Cargo fmt - -`cargo fmt --all` does not work in hyper. Please use the following commands: - -```txt -# Mac or Linux -rustfmt --check --edition 2018 $(git ls-files '*.rs') - -# Powershell -Get-ChildItem . -Filter "*.rs" -Recurse | foreach { rustfmt --check --edition 2018 $_.FullName } -``` - -> **NOTE**: If you are using `rust-analyzer`, you can add the following two lines in your `settings.json` to make sure the features get taken into account when checking the project: -> -> ```json -> "rust-analyzer.cargo.features": ["full"], -> "rust-analyzer.check.features": ["full"], -> ```