1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-31 04:27:45 +00:00

feat: trim end of whitespace lines

This commit is contained in:
Kevin Amado 2022-01-28 00:08:27 -05:00
parent c671ef15fc
commit b6679fa6e3
No known key found for this signature in database
GPG key ID: FFF341057F503148
4 changed files with 21 additions and 21 deletions

View file

@ -10,6 +10,4 @@ let
}; };
flake = import flakeCompatSrc { src = ./.; }; flake = import flakeCompatSrc { src = ./.; };
in in
flake flake.defaultNix.defaultPackage
.defaultNix
.defaultPackage

View file

@ -46,7 +46,7 @@
packages = [ nixpkgs.cargo-tarpaulin nixpkgs.rustup ]; packages = [ nixpkgs.cargo-tarpaulin nixpkgs.rustup ];
shellHook = shellHook =
'' ''
rustup toolchain install nightly rustup toolchain install nightly
''; '';
}; };
packages = { packages = {
@ -58,15 +58,15 @@
builtins.toFile builtins.toFile
"builder.sh" "builder.sh"
'' ''
source $stdenv/setup source $stdenv/setup
cp -rT $nixpkgs $out cp -rT $nixpkgs $out
chmod -R +w $out chmod -R +w $out
alejandra $out alejandra $out
git diff --no-index $nixpkgs $out > $diff || true git diff --no-index $nixpkgs $out > $diff || true
''; '';
buildInputs = [ inputs.self.defaultPackage.${ system } nixpkgs.git ]; buildInputs = [ inputs.self.defaultPackage.${ system } nixpkgs.git ];
nixpkgs = inputs.nixpkgs.sourceInfo.outPath; nixpkgs = inputs.nixpkgs.sourceInfo.outPath;
NIX_BUILD_CORES = 0; NIX_BUILD_CORES = 0;

View file

@ -91,11 +91,13 @@ pub fn rule(
.collect(); .collect();
if portions.len() == 1 { if portions.len() == 1 {
steps.push_back(crate::builder::Step::Pad); if portions[0].len() > 0 || index + 1 == lines.len() {
steps.push_back(crate::builder::Step::Token( steps.push_back(crate::builder::Step::Pad);
rnix::SyntaxKind::TOKEN_STRING_CONTENT, steps.push_back(crate::builder::Step::Token(
portions[0].to_string(), rnix::SyntaxKind::TOKEN_STRING_CONTENT,
)); portions[0].to_string(),
));
}
} else { } else {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
for (index, portion) in portions.iter().enumerate() { for (index, portion) in portions.iter().enumerate() {

View file

@ -16,14 +16,14 @@
'' ${ "" }'' '' ${ "" }''
### ###
'' ${ "" } '' ${ "" }
'' ''
### ###
'' a '' a
'' ''
### ###
'' a '' a
'' ''
### ###
'' a '' a
@ -32,7 +32,7 @@
'' a '' a
'' ''
### ###
'' ''
a a
${ "" } ${ "" }
b b
@ -41,10 +41,10 @@
e e
'' ''
### ###
'' ''
'' ''
### ###
'' ''
declare -a makefiles=(./*.mak) declare -a makefiles=(./*.mak)
sed -i -f ${ makefile-sed } "''${makefiles[@]}" sed -i -f ${ makefile-sed } "''${makefiles[@]}"
### assign Makefile variables eagerly & change backticks to `$(shell …)` ### assign Makefile variables eagerly & change backticks to `$(shell …)`
@ -53,7 +53,7 @@
"''${makefiles[@]}" "''${makefiles[@]}"
'' ''
### ###
'' ''
[${ mkSectionName sectName }] [${ mkSectionName sectName }]
'' ''
### ###