Use dprint for formatting Cargo.toml files

Invoking cargo tomlfmt on all files is a PITA and as we can see from
the CI scripts, it is often forgotten to as new crates are added to
the workspace.

Using dprint for toml files fixes this.

Unfortunately, we can't use dprint for Rust code yet because there
hasn't been a release of rustfmt in quite a while but we are already
using features from a newer rustfmt via rustup.
This commit is contained in:
Thomas Eizinger 2021-04-29 17:32:42 +10:00
parent c0501627c9
commit 1820139786
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
7 changed files with 47 additions and 57 deletions

View File

@ -1,14 +0,0 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"projectType": "openSource",
"incremental": true,
"markdown": {
},
"includes": ["**/*.{md}"],
"excludes": [
],
"plugins": [
"https://plugins.dprint.dev/markdown-0.6.1.wasm"
]
}

View File

@ -16,22 +16,11 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1.2.0 - uses: Swatinem/rust-cache@v1.2.0
id: cache
- name: Install tomlfmt
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install cargo-tomlfmt
- name: Check Cargo.toml formatting
run: |
cargo tomlfmt -d -p Cargo.toml
cargo tomlfmt -d -p monero-harness/Cargo.toml
cargo tomlfmt -d -p swap/Cargo.toml
- name: Check code formatting - name: Check code formatting
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
- name: Check markdown formatting - name: Check formatting
uses: dprint/check@v1.3 uses: dprint/check@v1.3
- name: Run clippy with default features - name: Run clippy with default features

15
dprint.json Normal file
View File

@ -0,0 +1,15 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"projectType": "openSource",
"incremental": true,
"markdown": {
},
"includes": ["**/*.{md}", "**/*.{toml}"],
"excludes": [
"./tokio-tar/Cargo.toml"
],
"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"
]
}

View File

@ -6,9 +6,9 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1" anyhow = "1"
jsonrpc_client = { version = "0.6", features = [ "reqwest" ] }
monero = "0.11"
reqwest = { version = "0.11", default-features = false, features = [ "json" ] } reqwest = { version = "0.11", default-features = false, features = [ "json" ] }
serde = { version = "1.0", features = [ "derive" ] } serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0" serde_json = "1.0"
tracing = "0.1" tracing = "0.1"
jsonrpc_client = { version = "0.6", features = ["reqwest"] }
monero = "0.11"