From 86e376ae75120588e5ea0fc8144ebde7d071feb5 Mon Sep 17 00:00:00 2001 From: Daniel Bittman Date: Thu, 18 Apr 2024 12:02:00 -0700 Subject: [PATCH 1/2] Adding automatic formatting. --- .pre-commit-config.yaml | 15 +++++++++++++++ .rustfmt.toml | 7 +++++++ 2 files changed, 22 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 .rustfmt.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..e84119f1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files +- repo: local + hooks: + - id: fmt + name: fmt + entry: bash -c "cargo fmt --all" + language: system + types: [rust] + args: [""] diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 00000000..dafd123c --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,7 @@ +edition = "2021" +use_field_init_shorthand = true +newline_style = "Unix" +comment_width = 100 +format_code_in_doc_comments = true +imports_granularity = "Crate" +wrap_comments = true From 7b6663a037384a57c2b9e2069e4a5163e3704096 Mon Sep 17 00:00:00 2001 From: Daniel Bittman Date: Fri, 19 Apr 2024 12:04:53 -0700 Subject: [PATCH 2/2] Add group_imports. --- .rustfmt.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rustfmt.toml b/.rustfmt.toml index dafd123c..5b55cdb0 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -5,3 +5,4 @@ comment_width = 100 format_code_in_doc_comments = true imports_granularity = "Crate" wrap_comments = true +group_imports = "StdExternalCrate"