File: rustfmt

package info (click to toggle)
rust-derive-deftly 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,652 kB
  • sloc: perl: 1,032; sh: 373; python: 227; makefile: 11
file content (27 lines) | stat: -rwxr-xr-x 806 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#
# Run rustfmt on all the files.  This script is needed because cargo
# fmt doesn't do the ones in tests/* (that are tested via trybuild and
# macrotest), because those aren't visible to cargo in the usual way.
#
# Any arguments are passed through to *both* "cargo fmt" and "rustfmt"

set -euo pipefail

# CARGO='nailing-cargo -E' maint/rustfmt

case "${CARGO-}" in
*nailing-cargo*)	NAILING_CARGO=${CARGO} ;;
*)			NAILING_CARGO= ;;
esac

${CARGO-cargo} fmt "$@"

# *.expanded.rs is managed by macrotest and mustn't be reformatted
# (the grep is because git-ls-files -x doesn't do what you'd think it would -
# it only applies if the file is untracked.)
git ls-files tests/{ui,expand}/'*.rs' |
    grep -v '\.expanded\.rs$' |
    xargs \
	${NAILING_CARGO} ${NAILING_CARGO:+---} \
	rustfmt "$@"