1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

refactor: use more rustfmt rules

This commit is contained in:
Kevin Amado 2022-07-10 11:57:09 -06:00
parent 529821fb40
commit 8f724a92c4
4 changed files with 54 additions and 2 deletions

39
flake.lock generated
View file

@ -1,5 +1,26 @@
{
"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": {
"flake": false,
"locked": {
@ -34,9 +55,27 @@
},
"root": {
"inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat",
"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",

View file

@ -2,6 +2,9 @@
description = "The Uncompromising Nix Code Formatter";
inputs = {
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
flakeCompat.url = github:edolstra/flake-compat;
flakeCompat.flake = false;
@ -103,6 +106,7 @@
cargo-tarpaulin
clippy
jq
inputs.fenix.packages."x86_64-linux".latest.rustfmt
linuxPackages_latest.perf
nodejs
nodePackages.prettier

View file

@ -1,18 +1,25 @@
# https://github.com/kamadorueda/machine/blob/main/nixos-modules/editor/rustfmt.toml
edition = "2021"
enum_discrim_align_threshold = 999
# force_multiline_blocks = true
format_code_in_doc_comments = true
format_generated_files = true
format_macro_bodies = true
format_macro_matchers = true
format_strings = true
group_imports = "StdExternalCrate"
hex_literal_case = "Lower"
imports_granularity = "Item"
imports_layout = "Vertical"
# match_block_trailing_comma = true
max_width = 80
normalize_comments = true
normalize_doc_attributes = true
overflow_delimited_expr = true
reorder_impl_items = true
struct_field_align_threshold = 999
unstable_features = true
use_field_init_shorthand = true
use_small_heuristics = "Max"
version = "Two"
wrap_comments = true

View file

@ -29,11 +29,13 @@ struct Args {
#[clap(long, short, multiple_occurrences = true)]
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)]
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)]
threads: Option<usize>,