mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 04:27:45 +00:00
refactor: use more rustfmt rules
This commit is contained in:
parent
529821fb40
commit
8f724a92c4
4 changed files with 54 additions and 2 deletions
39
flake.lock
generated
39
flake.lock
generated
|
@ -1,5 +1,26 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1657434367,
|
||||||
|
"narHash": "sha256-GR/3TFaG/77MQEYjvRRueELUrbz10fa68xcU1Ej4Ww0=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "a73d841dbc39cdd881ae2ee7cb3991e357f9f9cc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flakeCompat": {
|
"flakeCompat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -34,9 +55,27 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
"flakeCompat": "flakeCompat",
|
"flakeCompat": "flakeCompat",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1657398392,
|
||||||
|
"narHash": "sha256-HU1+Rql35ouZe0lx1ftCMDDwC9lqN3COudvMe+8XIx0=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "5342f47f4276641ddb5f0a5e08fb307742d6cdc4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
description = "The Uncompromising Nix Code Formatter";
|
description = "The Uncompromising Nix Code Formatter";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
|
fenix.url = "github:nix-community/fenix";
|
||||||
|
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
flakeCompat.url = github:edolstra/flake-compat;
|
flakeCompat.url = github:edolstra/flake-compat;
|
||||||
flakeCompat.flake = false;
|
flakeCompat.flake = false;
|
||||||
|
|
||||||
|
@ -103,6 +106,7 @@
|
||||||
cargo-tarpaulin
|
cargo-tarpaulin
|
||||||
clippy
|
clippy
|
||||||
jq
|
jq
|
||||||
|
inputs.fenix.packages."x86_64-linux".latest.rustfmt
|
||||||
linuxPackages_latest.perf
|
linuxPackages_latest.perf
|
||||||
nodejs
|
nodejs
|
||||||
nodePackages.prettier
|
nodePackages.prettier
|
||||||
|
|
|
@ -1,18 +1,25 @@
|
||||||
|
# https://github.com/kamadorueda/machine/blob/main/nixos-modules/editor/rustfmt.toml
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
enum_discrim_align_threshold = 999
|
enum_discrim_align_threshold = 999
|
||||||
|
# force_multiline_blocks = true
|
||||||
format_code_in_doc_comments = true
|
format_code_in_doc_comments = true
|
||||||
format_generated_files = true
|
format_generated_files = true
|
||||||
format_macro_bodies = true
|
format_macro_bodies = true
|
||||||
format_macro_matchers = true
|
format_macro_matchers = true
|
||||||
format_strings = true
|
format_strings = true
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
hex_literal_case = "Lower"
|
hex_literal_case = "Lower"
|
||||||
imports_granularity = "Item"
|
imports_granularity = "Item"
|
||||||
imports_layout = "Vertical"
|
imports_layout = "Vertical"
|
||||||
|
# match_block_trailing_comma = true
|
||||||
max_width = 80
|
max_width = 80
|
||||||
normalize_comments = true
|
normalize_comments = true
|
||||||
normalize_doc_attributes = true
|
normalize_doc_attributes = true
|
||||||
|
overflow_delimited_expr = true
|
||||||
reorder_impl_items = true
|
reorder_impl_items = true
|
||||||
struct_field_align_threshold = 999
|
struct_field_align_threshold = 999
|
||||||
unstable_features = true
|
unstable_features = true
|
||||||
|
use_field_init_shorthand = true
|
||||||
use_small_heuristics = "Max"
|
use_small_heuristics = "Max"
|
||||||
version = "Two"
|
version = "Two"
|
||||||
|
wrap_comments = true
|
||||||
|
|
|
@ -29,11 +29,13 @@ struct Args {
|
||||||
#[clap(long, short, multiple_occurrences = true)]
|
#[clap(long, short, multiple_occurrences = true)]
|
||||||
exclude: Vec<String>,
|
exclude: Vec<String>,
|
||||||
|
|
||||||
/// Check if the input is already formatted and disable writing in-place the modified content
|
/// Check if the input is already formatted and disable writing in-place
|
||||||
|
/// the modified content
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
check: bool,
|
check: bool,
|
||||||
|
|
||||||
/// Number of formatting threads to spawn. Defaults to the number of logical CPUs.
|
/// Number of formatting threads to spawn. Defaults to the number of
|
||||||
|
/// logical CPUs.
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
threads: Option<usize>,
|
threads: Option<usize>,
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue