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

Merge pull request #110 from kamadorueda/kamadorueda

feat: remove unnecesary newlines
This commit is contained in:
Kevin Amado 2022-02-16 18:57:04 -05:00 committed by GitHub
commit 63f3a44880
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View file

@ -9,12 +9,9 @@ steps:
queue: private
artifacts:
# Builds on: aarch64-darwin
# - aarch64-apple-darwin
# - alejandra-aarch64-apple-darwin
# Builds on: aarch64-linux
# - aarch64-unknown-linux-musl
# Builds on: x86_64-linux
# Builds on: aarch64-linux, x86_64-linux
- alejandra-aarch64-unknown-linux-musl
# Builds on: x86_64-darwin
@ -68,7 +65,7 @@ steps:
- git clone --branch=master --depth 1 --origin=upstream file:///data/nixpkgs
- echo --- Formatting - before
- nix run github:kamadorueda/alejandra -- nixpkgs 2>/dev/null
- nix --tarball-ttl 1 run github:kamadorueda/alejandra -- nixpkgs 2>/dev/null
- git -C nixpkgs add .
- git -C nixpkgs commit -m formatting-before -q
- git -C nixpkgs branch formatting-before

View file

@ -25,19 +25,18 @@ pub fn rule(
}
// /**/
let mut comment = false;
children.drain_comments_and_newlines(|element| match element {
crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
comment = true;
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
});
if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind()
{
if comment {
steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
} else {