crosvm/bin/fmt
Dylan Reid 7e24a8e759 bin/fmt: Set rustfmt edition to 2018
The default is 2015 and that causes any usage of `async` to cause kokoro
errors.

Change-Id: I9f962b6f578b0d1992377dfefdd724c080a6f1b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2024365
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
2020-02-05 09:00:27 +00:00

30 lines
786 B
Bash
Executable file

#!/bin/bash
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Run `rustfmt` on all Rust code contained in crosvm. This is different from
# `cargo fmt --all` which formats multiple crates but a single workspace only.
# Crosvm consists of multiple workspaces.
#
# Usage:
#
# $ bin/fmt
#
# To print a diff and exit 1 if code is not formatted, but without changing any
# files, use:
#
# $ bin/fmt --check
#
set -euo pipefail
# Change into directory of script, which is crosvm/bin.
cd "$(dirname "${BASH_SOURCE[0]}")"
# Jump up to root directory of crosvm repo.
cd ..
find . -name '*.rs' -print0 | grep -vz '^./target/' | xargs -0 rustfmt --edition=2018 "$@" --