Skip to content

Commit

Permalink
Merge pull request #3465 from flip1995/rustfmt
Browse files Browse the repository at this point in the history
rustfmt everything once and for all
  • Loading branch information
oli-obk authored Nov 28, 2018
2 parents a03ce65 + 14d1e8d commit f583152
Show file tree
Hide file tree
Showing 150 changed files with 3,192 additions and 2,864 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ before_install:
install:
- |
if [ -z ${INTEGRATION} ]; then
rustup component add rustfmt-preview || cargo install --git https://github.com/rust-lang/rustfmt/ --force
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
. $HOME/.nvm/nvm.sh
nvm install stable
Expand Down
19 changes: 17 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ All contributors are expected to follow the [Rust Code of Conduct](http://www.ru
* [Author lint](#author-lint)
* [Documentation](#documentation)
* [Running test suite](#running-test-suite)
* [Running rustfmt](#running-rustfmt)
* [Testing manually](#testing-manually)
* [Linting Clippy with your local changes](#linting-clippy-with-your-local-changes)
* [How Clippy works](#how-clippy-works)
* [Fixing nightly build failures](#fixing-build-failures-caused-by-rust)
* [Contributions](#contributions)
Expand Down Expand Up @@ -146,14 +148,26 @@ Therefore you should use `tests/ui/update-all-references.sh` (after running
`cargo test`) and check whether the output looks as you expect with `git diff`. Commit all
`*.stderr` files, too.

### Running rustfmt

[Rustfmt](https://github.com/rust-lang/rustfmt) is a tool for formatting Rust code according
to style guidelines. The code has to be formatted by `rustfmt` before a PR will be merged.

It can be installed via `rustup`:
```bash
rustup component add rustfmt-preview
```

Use `cargo fmt --all` to format the whole codebase.

### Testing manually

Manually testing against an example file is useful if you have added some
`println!`s and test suite output becomes unreadable. To try Clippy with your
local modifications, run `env CLIPPY_TESTS=true cargo run --bin clippy-driver -- -L ./target/debug input.rs`
from the working copy root.

### Linting Clippy with your changes locally
### Linting Clippy with your local changes

Clippy CI only passes if all lints defined in the version of the Clippy being
tested pass (that is, don’t report any suggestions). You can avoid prolonging
Expand Down Expand Up @@ -246,7 +260,8 @@ Contributions to Clippy should be made in the form of GitHub pull requests. Each
be reviewed by a core contributor (someone with permission to land patches) and either landed in the
main tree or given feedback for changes that would be required.

All code in this repository is under the [Mozilla Public License, 2.0](https://www.mozilla.org/MPL/2.0/)
All code in this repository is under the [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0>)
or the [MIT](http://opensource.org/licenses/MIT) license.

<!-- adapted from https://github.com/servo/servo/blob/master/CONTRIBUTING.md -->

Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.


fn main() {
// Forward the profile to the main compilation
println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap());
Expand Down
1 change: 1 addition & 0 deletions ci/base-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cd clippy_dev && cargo test && cd ..

# Perform various checks for lint registration
./util/dev update_lints --check
cargo +nightly fmt --all -- --check

CLIPPY="`pwd`/target/debug/cargo-clippy clippy"
# run clippy on its own codebase...
Expand Down
Loading

0 comments on commit f583152

Please sign in to comment.