diff --git a/CHANGELOG.md b/CHANGELOG.md index 272dc30..ed357ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.2.0] - 2022-02-17 + ### Added -- Pre-built binaries for x86_64-linux and aarch64-linux +- Pre-built binaries for x86_64-linux and aarch64-linux. +- Made the logic of the `or-default` (`a or b`) node + to be equal to the binary operator (`a $operator b`). + This increases consistency across the same family of elements. +- Remove users freedom to insert newlines + before the `?` in pattern bindings (`a ? b`). + + Inserting a newline after the `?` is still possible. + + This increases consistency on where to break a long pattern binding. + +- Remove space on empty containers (`[]`, `{}`). +- Add a `--version` flag to the CLI. +- Reduce 1 indentation level in `let-in` expressions, + when the target expression is a parenthesis, attr-set, list, or string. +- Support inline comments on lists, attr-sets, and let-in expressions. +- String interpolations in multi-line strings + now have a nice-looking indentation. + +### Fixed + +- A bug in the current position counter + caused a small percentage of multiline comments in Nixpkgs + to be unaligned by one character. ## [0.1.0] - 2022-02-14 @@ -26,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- -[unreleased]: https://github.com/kamadorueda/alejandra/compare/0.1.0...HEAD +[unreleased]: https://github.com/kamadorueda/alejandra/compare/0.2.0...HEAD +[0.1.0]: https://github.com/kamadorueda/alejandra/compare/0.1.0...0.2.0 [0.1.0]: https://github.com/kamadorueda/alejandra/compare/0.0.0...0.1.0 [0.0.0]: https://github.com/kamadorueda/alejandra/compare/6adfbe8516bf6d9e896534e01118e1bc41f65425...0.0.0 diff --git a/Cargo.lock b/Cargo.lock index 1081943..6cb1eb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "alejandra" -version = "0.1.0" +version = "0.2.0" dependencies = [ "clap", "indoc", diff --git a/Cargo.toml b/Cargo.toml index cf729da..b7cadbb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,4 @@ description = "The Uncompromising Nix Code Formatter" edition = "2021" name = "alejandra" repository = "https://github.com/kamadorueda/alejandra" -version = "0.1.0" +version = "0.2.0" diff --git a/flake.nix b/flake.nix index 7655411..9a7e91f 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ let commit = inputs.self.shortRev or "dirty"; date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101"; - in "0.1.0+${builtins.substring 0 8 date}.${commit}"; + in "0.2.0+${builtins.substring 0 8 date}.${commit}"; src = ./.; inherit target; cargoLock.lockFile = ./Cargo.lock; diff --git a/front/Cargo.lock b/front/Cargo.lock index 984fe1f..d80f6c6 100644 --- a/front/Cargo.lock +++ b/front/Cargo.lock @@ -4,26 +4,26 @@ version = 3 [[package]] name = "alejandra" -version = "0.1.0" +version = "0.2.0" dependencies = [ - "clap", - "indoc", - "rand", - "rayon", - "rnix", - "rowan 0.15.3", - "walkdir", + "clap", + "indoc", + "rand", + "rayon", + "rnix", + "rowan 0.15.3", + "walkdir", ] [[package]] name = "alejandra-front" -version = "0.1.0" +version = "0.2.0" dependencies = [ - "alejandra", - "console_error_panic_hook", - "getrandom", - "wasm-bindgen", - "wee_alloc", + "alejandra", + "console_error_panic_hook", + "getrandom", + "wasm-bindgen", + "wee_alloc", ] [[package]] @@ -31,11 +31,7 @@ name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] +dependencies = ["hermit-abi", "libc", "winapi"] [[package]] name = "autocfg" @@ -60,9 +56,7 @@ name = "cbitset" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29b6ad25ae296159fb0da12b970b2fe179b234584d7cd294c891e2bbb284466b" -dependencies = [ - "num-traits", -] +dependencies = ["num-traits"] [[package]] name = "cfg-if" @@ -82,14 +76,14 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5f1fea81f183005ced9e59cdb01737ef2423956dac5a6d731b06b2ecfaa3467" dependencies = [ - "atty", - "bitflags", - "indexmap", - "lazy_static", - "os_str_bytes", - "strsim", - "termcolor", - "textwrap", + "atty", + "bitflags", + "indexmap", + "lazy_static", + "os_str_bytes", + "strsim", + "termcolor", + "textwrap", ] [[package]] @@ -97,10 +91,7 @@ name = "console_error_panic_hook" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen", -] +dependencies = ["cfg-if 1.0.0", "wasm-bindgen"] [[package]] name = "countme" @@ -119,21 +110,14 @@ name = "crossbeam-channel" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] +dependencies = ["cfg-if 1.0.0", "crossbeam-utils"] [[package]] name = "crossbeam-deque" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] +dependencies = ["cfg-if 1.0.0", "crossbeam-epoch", "crossbeam-utils"] [[package]] name = "crossbeam-epoch" @@ -141,11 +125,11 @@ version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] @@ -153,10 +137,7 @@ name = "crossbeam-utils" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6" -dependencies = [ - "cfg-if 1.0.0", - "lazy_static", -] +dependencies = ["cfg-if 1.0.0", "lazy_static"] [[package]] name = "either" @@ -169,13 +150,7 @@ name = "getrandom" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] +dependencies = ["cfg-if 1.0.0", "js-sys", "libc", "wasi", "wasm-bindgen"] [[package]] name = "hashbrown" @@ -200,37 +175,28 @@ name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +dependencies = ["libc"] [[package]] name = "indexmap" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" -dependencies = [ - "autocfg", - "hashbrown 0.11.2", -] +dependencies = ["autocfg", "hashbrown 0.11.2"] [[package]] name = "indoc" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136" -dependencies = [ - "unindent", -] +dependencies = ["unindent"] [[package]] name = "js-sys" version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" -dependencies = [ - "wasm-bindgen", -] +dependencies = ["wasm-bindgen"] [[package]] name = "lazy_static" @@ -249,9 +215,7 @@ name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if 1.0.0", -] +dependencies = ["cfg-if 1.0.0"] [[package]] name = "memchr" @@ -264,9 +228,7 @@ name = "memoffset" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] +dependencies = ["autocfg"] [[package]] name = "memory_units" @@ -279,28 +241,21 @@ name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] +dependencies = ["autocfg"] [[package]] name = "num_cpus" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] +dependencies = ["hermit-abi", "libc"] [[package]] name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] +dependencies = ["memchr"] [[package]] name = "ppv-lite86" @@ -313,60 +268,42 @@ name = "proc-macro2" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" -dependencies = [ - "unicode-xid", -] +dependencies = ["unicode-xid"] [[package]] name = "quote" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" -dependencies = [ - "proc-macro2", -] +dependencies = ["proc-macro2"] [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] +dependencies = ["libc", "rand_chacha", "rand_core"] [[package]] name = "rand_chacha" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] +dependencies = ["ppv-lite86", "rand_core"] [[package]] name = "rand_core" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] +dependencies = ["getrandom"] [[package]] name = "rayon" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] +dependencies = ["autocfg", "crossbeam-deque", "either", "rayon-core"] [[package]] name = "rayon-core" @@ -374,11 +311,11 @@ version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] @@ -386,11 +323,7 @@ name = "rnix" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "065c5eac8e8f7e7b0e7227bdc46e2d8dd7d69fff7a9a2734e21f686bbcb9b2c9" -dependencies = [ - "cbitset", - "rowan 0.12.6", - "smol_str", -] +dependencies = ["cbitset", "rowan 0.12.6", "smol_str"] [[package]] name = "rowan" @@ -398,11 +331,11 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1b36e449f3702f3b0c821411db1cbdf30fb451726a9456dce5dabcd44420043" dependencies = [ - "countme 2.0.4", - "hashbrown 0.9.1", - "memoffset", - "rustc-hash", - "text-size", + "countme 2.0.4", + "hashbrown 0.9.1", + "memoffset", + "rustc-hash", + "text-size", ] [[package]] @@ -411,11 +344,11 @@ version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c72a0c863fef62cfd9ca7b72a35b422d7672dbffac4ac8003dcc3be7837d871d" dependencies = [ - "countme 3.0.0", - "hashbrown 0.12.0", - "memoffset", - "rustc-hash", - "text-size", + "countme 3.0.0", + "hashbrown 0.12.0", + "memoffset", + "rustc-hash", + "text-size", ] [[package]] @@ -429,9 +362,7 @@ name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +dependencies = ["winapi-util"] [[package]] name = "scopeguard" @@ -450,9 +381,7 @@ name = "smol_str" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61d15c83e300cce35b7c8cd39ff567c1ef42dde6d4a1a38dbdbf9a59902261bd" -dependencies = [ - "serde", -] +dependencies = ["serde"] [[package]] name = "strsim" @@ -465,20 +394,14 @@ name = "syn" version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] +dependencies = ["proc-macro2", "quote", "unicode-xid"] [[package]] name = "termcolor" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" -dependencies = [ - "winapi-util", -] +dependencies = ["winapi-util"] [[package]] name = "text-size" @@ -509,11 +432,7 @@ name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] +dependencies = ["same-file", "winapi", "winapi-util"] [[package]] name = "wasi" @@ -526,10 +445,7 @@ name = "wasm-bindgen" version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" -dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", -] +dependencies = ["cfg-if 1.0.0", "wasm-bindgen-macro"] [[package]] name = "wasm-bindgen-backend" @@ -537,13 +453,13 @@ version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", ] [[package]] @@ -551,10 +467,7 @@ name = "wasm-bindgen-macro" version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] +dependencies = ["quote", "wasm-bindgen-macro-support"] [[package]] name = "wasm-bindgen-macro-support" @@ -562,11 +475,11 @@ version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] @@ -580,22 +493,14 @@ name = "wee_alloc" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] +dependencies = ["cfg-if 0.1.10", "libc", "memory_units", "winapi"] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] +dependencies = ["winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu"] [[package]] name = "winapi-i686-pc-windows-gnu" @@ -608,9 +513,7 @@ name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] +dependencies = ["winapi"] [[package]] name = "winapi-x86_64-pc-windows-gnu" diff --git a/front/Cargo.toml b/front/Cargo.toml index 314fbc0..8df23c8 100644 --- a/front/Cargo.toml +++ b/front/Cargo.toml @@ -14,4 +14,4 @@ description = "The Uncompromising Nix Code Formatter" edition = "2021" name = "alejandra-front" repository = "https://github.com/kamadorueda/alejandra" -version = "0.1.0" +version = "0.2.0" diff --git a/installers/aarch64-linux.sh b/installers/aarch64-linux.sh index 9839f7a..f0f5372 100755 --- a/installers/aarch64-linux.sh +++ b/installers/aarch64-linux.sh @@ -2,7 +2,7 @@ releases=https://github.com/kamadorueda/alejandra/releases/download/ target=alejandra-aarch64-unknown-linux-musl -version=0.1.0 +version=0.2.0 curl -o alejandra -L "${releases}/${version}/${target}" diff --git a/installers/x86_64-linux.sh b/installers/x86_64-linux.sh index 82aa66f..25570b4 100755 --- a/installers/x86_64-linux.sh +++ b/installers/x86_64-linux.sh @@ -2,7 +2,7 @@ releases=https://github.com/kamadorueda/alejandra/releases/download/ target=alejandra-x86_64-unknown-linux-musl -version=0.1.0 +version=0.2.0 curl -o alejandra -L "${releases}/${version}/${target}"