From 694ade11d1eed35868d36ed077641592617f1582 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 25 May 2021 14:40:31 +1000 Subject: [PATCH] Replace cargo-fmt with dprint If we want to use stable Rust, we can't use cargo-fmt with nightly features. --- .github/workflows/ci.yml | 3 --- dprint.json | 18 +++++++++++++++--- rust-toolchain | 2 +- rustfmt.toml | 12 ------------ 4 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 rustfmt.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dc88d9e..f9e9f229 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,6 @@ jobs: - uses: Swatinem/rust-cache@v1.2.0 - - name: Check code formatting - run: cargo fmt --all -- --check - - name: Check formatting uses: dprint/check@v1.4 diff --git a/dprint.json b/dprint.json index 5e4931b2..c73d9690 100644 --- a/dprint.json +++ b/dprint.json @@ -4,10 +4,22 @@ "incremental": true, "markdown": { }, - "includes": ["**/*.{md}", "**/*.{toml}"], - "excludes": [ ], + "rustfmt": { + "edition": 2018, + "condense_wildcard_suffixes": true, + "format_macro_matchers": true, + "imports_granularity" : "Module", + "use_field_init_shorthand": true, + "format_code_in_doc_comments": true, + "normalize_comments": true, + "wrap_comments": true, + "overflow_delimited_expr": true + }, + "includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"], + "excludes": [ "target/" ], "plugins": [ "https://plugins.dprint.dev/markdown-0.6.1.wasm", - "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm" + "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm", + "https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2" ] } diff --git a/rust-toolchain b/rust-toolchain index 6a154529..1985a9e4 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] channel = "nightly-2021-01-31" -components = ["rustfmt", "clippy"] +components = ["clippy"] targets = ["armv7-unknown-linux-gnueabihf"] diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index 6e3e8004..00000000 --- a/rustfmt.toml +++ /dev/null @@ -1,12 +0,0 @@ -edition = "2018" -condense_wildcard_suffixes = true -format_macro_matchers = true -imports_granularity = "Module" -use_field_init_shorthand = true -format_code_in_doc_comments = true -normalize_comments = true -wrap_comments = true -overflow_delimited_expr = true -ignore = [ - "tokio-tar" -]