This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for FILE in `git diff --cached --name-only`; do | |
if [[ $FILE == *.rs ]] && ! rustfmt --write-mode diff --skip-children $FILE; then | |
echo "Commit rejected due to invalid formatting of \"$FILE\" file." | |
exit 1 | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Put in your Rust repository's .git/hooks/pre-commit to ensure you never | |
# breaks rustfmt. | |
# | |
# WARNING: rustfmt is a fast moving target so ensure you have the version that | |
# all contributors have. | |
for FILE in `git diff --cached --name-only`; do | |
#if [[ $FILE == *.rs ]] && ! rustup run nightly rustfmt --write-mode diff --skip-children $FILE; then |