Skip to content

rustfmt everything once and for all #3465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 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 All @@ -48,7 +49,7 @@ matrix:
- os: linux
env: BASE_TESTS=true
- os: windows
env: BASE_TEST=true
env: BASE_TESTS=true
- env: INTEGRATION=rust-lang/cargo
- env: INTEGRATION=rust-random/rand
- env: INTEGRATION=rust-lang-nursery/stdsimd
Expand All @@ -64,7 +65,7 @@ matrix:
- env: INTEGRATION=hyperium/hyper
allow_failures:
- os: windows
env: BASE_TEST=true
env: BASE_TESTS=true
# prevent these jobs with default env vars
exclude:
- os: linux
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 @@ -145,14 +147,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 @@ -245,7 +259,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