diff --git a/.github/deploy.sh b/.github/deploy.sh
old mode 100755
new mode 100644
index 19dc4017166c..4fcff830aa6f
--- a/.github/deploy.sh
+++ b/.github/deploy.sh
@@ -1,20 +1,7 @@
#!/bin/bash
-# Automatically deploy on gh-pages
-
set -ex
-SOURCE_BRANCH="master"
-TARGET_BRANCH="gh-pages"
-
-# Save some useful information
-REPO=$(git config remote.origin.url)
-SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
-SHA=$(git rev-parse --verify HEAD)
-
-# Clone the existing gh-pages for this repo into out/
-git clone --quiet --single-branch --branch "$TARGET_BRANCH" "$REPO" out
-
echo "Removing the current docs for master"
rm -rf out/master/ || exit 0
@@ -23,59 +10,34 @@ mkdir out/master/
cp util/gh-pages/index.html out/master
python ./util/export.py out/master/lints.json
-if [[ -n "$TRAVIS_TAG" ]]; then
- echo "Save the doc for the current tag ($TRAVIS_TAG) and point current/ to it"
- cp -r out/master "out/$TRAVIS_TAG"
- rm -f out/current
- ln -s "$TRAVIS_TAG" out/current
+if [[ -n $TAG_NAME ]]; then
+ echo "Save the doc for the current tag ($TAG_NAME) and point current/ to it"
+ cp -r out/master "out/$TAG_NAME"
+ rm -f out/current
+ ln -s "$TAG_NAME" out/current
fi
# Generate version index that is shown as root index page
cp util/gh-pages/versions.html out/index.html
-pushd out
+cd out
cat <<-EOF | python - > versions.json
import os, json
print json.dumps([
dir for dir in os.listdir(".") if not dir.startswith(".") and os.path.isdir(dir)
])
EOF
-popd
-
-# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
-if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || [[ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then
- # Tags should deploy
- if [[ -z "$TRAVIS_TAG" ]]; then
- echo "Generated, won't push"
- exit 0
- fi
-fi
# Now let's go have some fun with the cloned repo
-cd out
-git config user.name "Travis CI"
-git config user.email "travis@ci.invalid"
+git config user.name "GHA CI"
+git config user.email "gha@ci.invalid"
if git diff --exit-code --quiet; then
- echo "No changes to the output on this push; exiting."
- exit 0
+ echo "No changes to the output on this push; exiting."
+ exit 0
fi
-cd -
-# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
-ENCRYPTION_LABEL=e3a2d77100be
-ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
-ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
-ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
-ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
-openssl aes-256-cbc -K "$ENCRYPTED_KEY" -iv "$ENCRYPTED_IV" -in .github/deploy_key.enc -out .github/deploy_key -d
-chmod 600 .github/deploy_key
-eval "$(ssh-agent -s)"
-ssh-add .github/deploy_key
-
-cd out
git add .
git commit -m "Automatic deploy to GitHub Pages: ${SHA}"
-# Now that we're all set up, we can push.
git push "$SSH_REPO" "$TARGET_BRANCH"
diff --git a/.github/driver.sh b/.github/driver.sh
new file mode 100644
index 000000000000..a2e87f5eb374
--- /dev/null
+++ b/.github/driver.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -ex
+
+# Check sysroot handling
+sysroot=$(./target/debug/clippy-driver --print sysroot)
+test "$sysroot" = "$(rustc --print sysroot)"
+
+if [[ ${OS} == "Windows" ]]; then
+ desired_sysroot=C:/tmp
+else
+ desired_sysroot=/tmp
+fi
+sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
+test "$sysroot" = $desired_sysroot
+
+sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
+test "$sysroot" = $desired_sysroot
+
+# Make sure this isn't set - clippy-driver should cope without it
+unset CARGO_MANIFEST_DIR
+
+# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
+# FIXME: How to match the clippy invocation in compile-test.rs?
+./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1
+sed -e "s,tests/ui,\$DIR," -e "/= help/d" cstring.stderr > normalized.stderr
+diff normalized.stderr tests/ui/cstring.stderr
+
+# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR
diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml
new file mode 100644
index 000000000000..fb945060980d
--- /dev/null
+++ b/.github/workflows/clippy.yml
@@ -0,0 +1,98 @@
+name: Clippy Test
+
+on:
+ push:
+ # Ignore bors branches, since they are covered by `clippy_bors.yml`
+ branches-ignore: [auto, try]
+ # Don't run Clippy tests, when only textfiles were modified
+ paths-ignore:
+ - 'COPYRIGHT'
+ - 'LICENSE-*'
+ - '**.md'
+ - '**.txt'
+ pull_request:
+ # Don't run Clippy tests, when only textfiles were modified
+ paths-ignore:
+ - 'COPYRIGHT'
+ - 'LICENSE-*'
+ - '**.md'
+ - '**.txt'
+
+env:
+ RUST_BACKTRACE: 1
+ CARGO_TARGET_DIR: '${{ github.workspace }}/target'
+ NO_FMT_TEST: 1
+
+jobs:
+ base:
+ runs-on: ubuntu-latest
+
+ steps:
+ # Setup
+ - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
+ with:
+ github_token: "${{ secrets.github_token }}"
+
+ - name: rust-toolchain
+ uses: actions-rs/toolchain@v1.0.3
+ with:
+ toolchain: nightly
+ target: x86_64-unknown-linux-gnu
+ profile: minimal
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Run cargo update
+ run: cargo update
+
+ - name: Cache cargo dir
+ uses: actions/cache@v1
+ with:
+ path: ~/.cargo
+ key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-x86_64-unknown-linux-gnu
+
+ - name: Master Toolchain Setup
+ run: bash setup-toolchain.sh
+
+ # Run
+ - name: Set LD_LIBRARY_PATH (Linux)
+ run: |
+ SYSROOT=$(rustc --print sysroot)
+ echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
+
+ - name: Build
+ run: cargo build --features deny-warnings
+
+ - name: Test
+ run: cargo test --features deny-warnings
+
+ - name: Test clippy_lints
+ run: cargo test --features deny-warnings
+ working-directory: clippy_lints
+
+ - name: Test rustc_tools_util
+ run: cargo test --features deny-warnings
+ working-directory: rustc_tools_util
+
+ - name: Test clippy_dev
+ run: cargo test --features deny-warnings
+ working-directory: clippy_dev
+
+ - name: Test cargo-clippy
+ run: ../target/debug/cargo-clippy
+ working-directory: clippy_workspace_tests
+
+ - name: Test clippy-driver
+ run: bash .github/driver.sh
+ env:
+ OS: ${{ runner.os }}
+
+ # Cleanup
+ - name: Run cargo-cache --autoclean
+ run: |
+ cargo install cargo-cache --debug
+ find ~/.cargo/bin ! -type d -exec strip {} \;
+ cargo cache --autoclean
diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml
new file mode 100644
index 000000000000..a690573180f0
--- /dev/null
+++ b/.github/workflows/clippy_bors.yml
@@ -0,0 +1,328 @@
+name: Clippy Test (bors)
+
+on:
+ push:
+ branches: [auto, try]
+
+env:
+ RUST_BACKTRACE: 1
+ CARGO_TARGET_DIR: '${{ github.workspace }}/target'
+ NO_FMT_TEST: 1
+
+jobs:
+ changelog:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
+ with:
+ github_token: "${{ secrets.github_token }}"
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+ with:
+ ref: ${{ github.ref }}
+
+ # Run
+ - name: Check Changelog
+ run: |
+ MESSAGE=$(git log --format=%B -n 1)
+ PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//')
+ output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \
+ python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \
+ grep "^changelog: " | \
+ sed "s/changelog: //g")
+ if [[ -z "$output" ]]; then
+ echo "ERROR: PR body must contain 'changelog: ...'"
+ exit 1
+ elif [[ "$output" = "none" ]]; then
+ echo "WARNING: changelog is 'none'"
+ fi
+ env:
+ PYTHONIOENCODING: 'utf-8'
+ base:
+ needs: changelog
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]
+ exclude:
+ - os: ubuntu-latest
+ host: x86_64-apple-darwin
+ - os: ubuntu-latest
+ host: x86_64-pc-windows-msvc
+ - os: macos-latest
+ host: x86_64-unknown-linux-gnu
+ - os: macos-latest
+ host: i686-unknown-linux-gnu
+ - os: macos-latest
+ host: x86_64-pc-windows-msvc
+ - os: windows-latest
+ host: x86_64-unknown-linux-gnu
+ - os: windows-latest
+ host: i686-unknown-linux-gnu
+ - os: windows-latest
+ host: x86_64-apple-darwin
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ # Setup
+ - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
+ with:
+ github_token: "${{ secrets.github_token }}"
+
+ - name: Install dependencies (Linux-i686)
+ run: |
+ sudo dpkg --add-architecture i386
+ sudo apt-get update
+ sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386
+ if: matrix.host == 'i686-unknown-linux-gnu'
+
+ - name: rust-toolchain
+ uses: actions-rs/toolchain@v1.0.3
+ with:
+ toolchain: nightly
+ target: ${{ matrix.host }}
+ profile: minimal
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Run cargo update
+ run: cargo update
+
+ - name: Cache cargo dir
+ uses: actions/cache@v1
+ with:
+ path: ~/.cargo
+ key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ matrix.host }}
+
+ - name: Master Toolchain Setup
+ run: bash setup-toolchain.sh
+ env:
+ HOST_TOOLCHAIN: ${{ matrix.host }}
+ shell: bash
+
+ # Run
+ - name: Set LD_LIBRARY_PATH (Linux)
+ if: runner.os == 'Linux'
+ run: |
+ SYSROOT=$(rustc --print sysroot)
+ echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}"
+ - name: Link rustc dylib (MacOS)
+ if: runner.os == 'macOS'
+ run: |
+ SYSROOT=$(rustc --print sysroot)
+ sudo mkdir -p /usr/local/lib
+ sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \;
+ - name: Set PATH (Windows)
+ if: runner.os == 'Windows'
+ run: |
+ $sysroot = rustc --print sysroot
+ $env:PATH += ';' + $sysroot + '\bin'
+ echo "::set-env name=PATH::$env:PATH"
+
+ - name: Build
+ run: cargo build --features deny-warnings
+ shell: bash
+
+ - name: Test
+ run: cargo test --features deny-warnings
+ shell: bash
+
+ - name: Test clippy_lints
+ run: cargo test --features deny-warnings
+ shell: bash
+ working-directory: clippy_lints
+
+ - name: Test rustc_tools_util
+ run: cargo test --features deny-warnings
+ shell: bash
+ working-directory: rustc_tools_util
+
+ - name: Test clippy_dev
+ run: cargo test --features deny-warnings
+ shell: bash
+ working-directory: clippy_dev
+
+ - name: Test cargo-clippy
+ run: ../target/debug/cargo-clippy
+ shell: bash
+ working-directory: clippy_workspace_tests
+
+ - name: Test clippy-driver
+ run: bash .github/driver.sh
+ shell: bash
+ env:
+ OS: ${{ runner.os }}
+
+ # Cleanup
+ - name: Run cargo-cache --autoclean
+ run: |
+ cargo install cargo-cache --debug
+ /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \;
+ cargo cache --autoclean
+ shell: bash
+ integration_build:
+ needs: changelog
+ runs-on: ubuntu-latest
+
+ steps:
+ # Setup
+ - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
+ with:
+ github_token: "${{ secrets.github_token }}"
+
+ - name: rust-toolchain
+ uses: actions-rs/toolchain@v1.0.3
+ with:
+ toolchain: nightly
+ target: x86_64-unknown-linux-gnu
+ profile: minimal
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Run cargo update
+ run: cargo update
+
+ - name: Cache cargo dir
+ uses: actions/cache@v1
+ with:
+ path: ~/.cargo
+ key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-x86_64-unknown-linux-gnu
+
+ - name: Master Toolchain Setup
+ run: bash setup-toolchain.sh
+
+ # Run
+ - name: Build Integration Test
+ run: cargo test --test integration --features integration --no-run
+
+ # Upload
+ - name: Extract Binaries
+ run: |
+ DIR=$CARGO_TARGET_DIR/debug
+ find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
+ mv $DIR/integration-* $DIR/integration
+
+ - name: Upload Binaries
+ uses: actions/upload-artifact@v1
+ with:
+ name: target
+ path: target
+
+ # Cleanup
+ - name: Run cargo-cache --autoclean
+ run: |
+ cargo install cargo-cache --debug
+ find ~/.cargo/bin ! -type d -exec strip {} \;
+ cargo cache --autoclean
+ integration:
+ needs: integration_build
+ strategy:
+ fail-fast: false
+ max-parallel: 6
+ matrix:
+ integration:
+ - 'rust-lang/cargo'
+ - 'rust-lang/rls'
+ - 'rust-lang/chalk'
+ - 'rust-lang/rustfmt'
+ - 'Marwes/combine'
+ - 'Geal/nom'
+ - 'rust-lang/stdarch'
+ - 'serde-rs/serde'
+ - 'chronotope/chrono'
+ - 'hyperium/hyper'
+ - 'rust-random/rand'
+ - 'rust-lang/futures-rs'
+ - 'rust-itertools/itertools'
+ - 'rust-lang-nursery/failure'
+ - 'rust-lang/log'
+
+ runs-on: ubuntu-latest
+
+ steps:
+ # Setup
+ - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
+ with:
+ github_token: "${{ secrets.github_token }}"
+
+ - name: rust-toolchain
+ uses: actions-rs/toolchain@v1.0.3
+ with:
+ toolchain: nightly
+ target: x86_64-unknown-linux-gnu
+ profile: minimal
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Run cargo update
+ run: cargo update
+
+ - name: Cache cargo dir
+ uses: actions/cache@v1
+ with:
+ path: ~/.cargo
+ key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-x86_64-unknown-linux-gnu
+
+ - name: Master Toolchain Setup
+ run: bash setup-toolchain.sh
+
+ # Download
+ - name: Download target dir
+ uses: actions/download-artifact@v1
+ with:
+ name: target
+ path: target
+
+ - name: Make Binaries Executable
+ run: chmod +x $CARGO_TARGET_DIR/debug/*
+
+ # Run
+ - name: Test ${{ matrix.integration }}
+ run: $CARGO_TARGET_DIR/debug/integration
+ env:
+ INTEGRATION: ${{ matrix.integration }}
+ RUSTUP_TOOLCHAIN: master
+
+ # Cleanup
+ - name: Run cargo-cache --autoclean
+ run: |
+ cargo install cargo-cache --debug
+ find ~/.cargo/bin ! -type d -exec strip {} \;
+ cargo cache --autoclean
+
+ # These jobs doesn't actually test anything, but they're only used to tell
+ # bors the build completed, as there is no practical way to detect when a
+ # workflow is successful listening to webhooks only.
+ #
+ # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
+
+ end-success:
+ name: bors test finished
+ if: github.event.pusher.name == 'bors' && success()
+ runs-on: ubuntu-latest
+ needs: [base, integration]
+
+ steps:
+ - name: Mark the job as successful
+ run: exit 0
+
+ end-failure:
+ name: bors test finished
+ if: github.event.pusher.name == 'bors' && (failure() || cancelled())
+ runs-on: ubuntu-latest
+ needs: [base, integration]
+
+ steps:
+ - name: Mark the job as a failure
+ run: exit 1
diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml
new file mode 100644
index 000000000000..d6f5db014a43
--- /dev/null
+++ b/.github/workflows/clippy_dev.yml
@@ -0,0 +1,72 @@
+name: Clippy Dev Test
+
+on:
+ push:
+ branches: [auto, try]
+ pull_request:
+ # Only run on paths, that get checked by the clippy_dev tool
+ paths:
+ - 'CAHNGELOG.md'
+ - 'README.md'
+ - '**.stderr'
+ - '**.rs'
+
+env:
+ RUST_BACKTRACE: 1
+
+jobs:
+ clippy_dev:
+ runs-on: ubuntu-latest
+
+ steps:
+ # Setup
+ - name: rust-toolchain
+ uses: actions-rs/toolchain@v1.0.3
+ with:
+ toolchain: nightly
+ target: x86_64-unknown-linux-gnu
+ profile: minimal
+ components: rustfmt
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ # Run
+ - name: Build
+ run: cargo build --features deny-warnings
+ working-directory: clippy_dev
+
+ - name: Test limit-stderr-length
+ run: cargo dev --limit-stderr-length
+
+ - name: Test update_lints
+ run: cargo dev update_lints --check
+
+ - name: Test fmt
+ run: cargo dev fmt --check
+
+ # These jobs doesn't actually test anything, but they're only used to tell
+ # bors the build completed, as there is no practical way to detect when a
+ # workflow is successful listening to webhooks only.
+ #
+ # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
+
+ end-success:
+ name: bors dev test finished
+ if: github.event.pusher.name == 'bors' && success()
+ runs-on: ubuntu-latest
+ needs: [clippy_dev]
+
+ steps:
+ - name: Mark the job as successful
+ run: exit 0
+
+ end-failure:
+ name: bors dev test finished
+ if: github.event.pusher.name == 'bors' && (failure() || cancelled())
+ runs-on: ubuntu-latest
+ needs: [clippy_dev]
+
+ steps:
+ - name: Mark the job as a failure
+ run: exit 1
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 000000000000..6f79891358eb
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,35 @@
+name: Deploy
+
+on:
+ push:
+ branches: master
+ release:
+ types: [created]
+
+env:
+ TARGET_BRANCH: 'gh-pages'
+ SHA: '${{ github.sha }}'
+ SSH_REPO: 'git@github.com:${{ github.repository }}.git'
+ TAG_NAME: '${{ github.event.release.GITHUB_REF }}'
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+
+ steps:
+ # Setup
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+ with:
+ ref: ${{ env.TARGET_BRANCH }}
+ path: 'out'
+
+ # Run
+ - name: Deploy
+ run: |
+ eval "$(ssh-agent -s)"
+ ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
+ bash .github/deploy.sh
diff --git a/.github/workflows/remark.yml b/.github/workflows/remark.yml
new file mode 100644
index 000000000000..3544053d399a
--- /dev/null
+++ b/.github/workflows/remark.yml
@@ -0,0 +1,53 @@
+name: Remark
+
+on:
+ push:
+ branches: [auto, try]
+ pull_request:
+ paths:
+ - '**.md'
+
+jobs:
+ remark:
+ runs-on: ubuntu-latest
+
+ steps:
+ # Setup
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v1.1.0
+
+ - name: Install remark
+ run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended
+
+ # Run
+ - name: Check *.md files
+ run: git ls-files -z '*.md' | xargs -0 -n 1 -I {} ./node_modules/.bin/remark {} -u lint -f > /dev/null
+
+ # These jobs doesn't actually test anything, but they're only used to tell
+ # bors the build completed, as there is no practical way to detect when a
+ # workflow is successful listening to webhooks only.
+ #
+ # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
+
+ end-success:
+ name: bors remark test finished
+ if: github.event.pusher.name == 'bors' && success()
+ runs-on: ubuntu-latest
+ needs: [remark]
+
+ steps:
+ - name: Mark the job as successful
+ run: exit 0
+
+ end-failure:
+ name: bors remark test finished
+ if: github.event.pusher.name == 'bors' && (failure() || cancelled())
+ runs-on: ubuntu-latest
+ needs: [remark]
+
+ steps:
+ - name: Mark the job as a failure
+ run: exit 1
diff --git a/.gitignore b/.gitignore
index f1f4fa4e242a..adf5e8feddf4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-# Used by Travis to be able to push:
+# Used by CI to be able to push:
/.github/deploy_key
out
diff --git a/.remarkrc b/.remarkrc
new file mode 100644
index 000000000000..0ede7ac75cb6
--- /dev/null
+++ b/.remarkrc
@@ -0,0 +1,12 @@
+{
+ "plugins": [
+ "remark-preset-lint-recommended",
+ ["remark-lint-list-item-indent", false],
+ ["remark-lint-no-literal-urls", false],
+ ["remark-lint-no-shortcut-reference-link", false],
+ ["remark-lint-maximum-line-length", 120]
+ ],
+ "settings": {
+ "commonmark": true
+ }
+}
diff --git a/.remarkrc.json b/.remarkrc.json
deleted file mode 100644
index 22bae13ccf88..000000000000
--- a/.remarkrc.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "plugins": {
- "lint": {
- "table-pipes": false,
- "table-pipe-alignment": false,
- "maximum-line-length": 120
- }
- },
- "settings": {
- "commonmark": true
- }
-}
diff --git a/.travis.yml b/.travis.yml
index bd3003d45977..fa02f5334017 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -48,7 +48,7 @@ install:
. $HOME/.nvm/nvm.sh
nvm install stable
nvm use stable
- npm install remark-cli remark-lint
+ npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
choco install windows-sdk-10.1
fi
@@ -152,15 +152,3 @@ script:
else
./ci/base-tests.sh && sleep 5
fi
-
-after_success:
- - |
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
- set -e
- if [[ -z ${INTEGRATION} ]]; then
- ./.github/deploy.sh
- else
- echo "Not deploying, because we're in an integration test run"
- fi
- set +e
- fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0953432bfad7..04b85711fa59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -203,29 +203,29 @@ Released 2019-07-04
[eb9f9b1...082cfa7](https://github.com/rust-lang/rust-clippy/compare/eb9f9b1...082cfa7)
- * New lints: [`find_map`], [`filter_map_next`] [#4039](https://github.com/rust-lang/rust-clippy/pull/4039)
- * New lint: [`path_buf_push_overwrite`] [#3954](https://github.com/rust-lang/rust-clippy/pull/3954)
- * Move `path_buf_push_overwrite` to the nursery [#4013](https://github.com/rust-lang/rust-clippy/pull/4013)
- * Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101)
- * Allow allowing of [`toplevel_ref_arg`] lint [#4007](https://github.com/rust-lang/rust-clippy/pull/4007)
- * Fix false negative in [`or_fun_call`] pertaining to nested constructors [#4084](https://github.com/rust-lang/rust-clippy/pull/4084)
- * Fix false positive in [`or_fn_call`] pertaining to enum variant constructors [#4018](https://github.com/rust-lang/rust-clippy/pull/4018)
- * Fix false positive in [`useless_let_if_seq`] pertaining to interior mutability [#4035](https://github.com/rust-lang/rust-clippy/pull/4035)
- * Fix false positive in [`redundant_closure`] pertaining to non-function types [#4008](https://github.com/rust-lang/rust-clippy/pull/4008)
- * Fix false positive in [`let_and_return`] pertaining to attributes on `let`s [#4024](https://github.com/rust-lang/rust-clippy/pull/4024)
- * Fix false positive in [`module_name_repetitions`] lint pertaining to attributes [#4006](https://github.com/rust-lang/rust-clippy/pull/4006)
- * Fix false positive on [`assertions_on_constants`] pertaining to `debug_assert!` [#3989](https://github.com/rust-lang/rust-clippy/pull/3989)
- * Improve suggestion in [`map_clone`] to suggest `.copied()` where applicable [#3970](https://github.com/rust-lang/rust-clippy/pull/3970) [#4043](https://github.com/rust-lang/rust-clippy/pull/4043)
- * Improve suggestion for [`search_is_some`] [#4049](https://github.com/rust-lang/rust-clippy/pull/4049)
- * Improve suggestion applicability for [`naive_bytecount`] [#3984](https://github.com/rust-lang/rust-clippy/pull/3984)
- * Improve suggestion applicability for [`while_let_loop`] [#3975](https://github.com/rust-lang/rust-clippy/pull/3975)
- * Improve diagnostics for [`too_many_arguments`] [#4053](https://github.com/rust-lang/rust-clippy/pull/4053)
- * Improve diagnostics for [`cast_lossless`] [#4021](https://github.com/rust-lang/rust-clippy/pull/4021)
- * Deal with macro checks in desugarings better [#4082](https://github.com/rust-lang/rust-clippy/pull/4082)
- * Add macro check for [`unnecessary_cast`] [#4026](https://github.com/rust-lang/rust-clippy/pull/4026)
- * Remove [`approx_constant`]'s documentation's "Known problems" section. [#4027](https://github.com/rust-lang/rust-clippy/pull/4027)
- * Fix ICE in [`suspicious_else_formatting`] [#3960](https://github.com/rust-lang/rust-clippy/pull/3960)
- * Fix ICE in [`decimal_literal_representation`] [#3931](https://github.com/rust-lang/rust-clippy/pull/3931)
+* New lints: [`find_map`], [`filter_map_next`] [#4039](https://github.com/rust-lang/rust-clippy/pull/4039)
+* New lint: [`path_buf_push_overwrite`] [#3954](https://github.com/rust-lang/rust-clippy/pull/3954)
+* Move `path_buf_push_overwrite` to the nursery [#4013](https://github.com/rust-lang/rust-clippy/pull/4013)
+* Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101)
+* Allow allowing of [`toplevel_ref_arg`] lint [#4007](https://github.com/rust-lang/rust-clippy/pull/4007)
+* Fix false negative in [`or_fun_call`] pertaining to nested constructors [#4084](https://github.com/rust-lang/rust-clippy/pull/4084)
+* Fix false positive in [`or_fun_call`] pertaining to enum variant constructors [#4018](https://github.com/rust-lang/rust-clippy/pull/4018)
+* Fix false positive in [`useless_let_if_seq`] pertaining to interior mutability [#4035](https://github.com/rust-lang/rust-clippy/pull/4035)
+* Fix false positive in [`redundant_closure`] pertaining to non-function types [#4008](https://github.com/rust-lang/rust-clippy/pull/4008)
+* Fix false positive in [`let_and_return`] pertaining to attributes on `let`s [#4024](https://github.com/rust-lang/rust-clippy/pull/4024)
+* Fix false positive in [`module_name_repetitions`] lint pertaining to attributes [#4006](https://github.com/rust-lang/rust-clippy/pull/4006)
+* Fix false positive on [`assertions_on_constants`] pertaining to `debug_assert!` [#3989](https://github.com/rust-lang/rust-clippy/pull/3989)
+* Improve suggestion in [`map_clone`] to suggest `.copied()` where applicable [#3970](https://github.com/rust-lang/rust-clippy/pull/3970) [#4043](https://github.com/rust-lang/rust-clippy/pull/4043)
+* Improve suggestion for [`search_is_some`] [#4049](https://github.com/rust-lang/rust-clippy/pull/4049)
+* Improve suggestion applicability for [`naive_bytecount`] [#3984](https://github.com/rust-lang/rust-clippy/pull/3984)
+* Improve suggestion applicability for [`while_let_loop`] [#3975](https://github.com/rust-lang/rust-clippy/pull/3975)
+* Improve diagnostics for [`too_many_arguments`] [#4053](https://github.com/rust-lang/rust-clippy/pull/4053)
+* Improve diagnostics for [`cast_lossless`] [#4021](https://github.com/rust-lang/rust-clippy/pull/4021)
+* Deal with macro checks in desugarings better [#4082](https://github.com/rust-lang/rust-clippy/pull/4082)
+* Add macro check for [`unnecessary_cast`] [#4026](https://github.com/rust-lang/rust-clippy/pull/4026)
+* Remove [`approx_constant`]'s documentation's "Known problems" section. [#4027](https://github.com/rust-lang/rust-clippy/pull/4027)
+* Fix ICE in [`suspicious_else_formatting`] [#3960](https://github.com/rust-lang/rust-clippy/pull/3960)
+* Fix ICE in [`decimal_literal_representation`] [#3931](https://github.com/rust-lang/rust-clippy/pull/3931)
## Rust 1.35
@@ -234,27 +234,27 @@ Released 2019-05-20
[1fac380..37f5c1e](https://github.com/rust-lang/rust-clippy/compare/1fac380...37f5c1e)
- * New lint: [`drop_bounds`] to detect `T: Drop` bounds
- * Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101)
- * Rename `cyclomatic_complexity` to [`cognitive_complexity`], start work on making lint more practical for Rust code
- * Move [`get_unwrap`] to the restriction category
- * Improve suggestions for [`iter_cloned_collect`]
- * Improve suggestions for [`cast_lossless`] to suggest suffixed literals
- * Fix false positives in [`print_with_newline`] and [`write_with_newline`] pertaining to raw strings
- * Fix false positive in [`needless_range_loop`] pertaining to structs without a `.iter()`
- * Fix false positive in [`bool_comparison`] pertaining to non-bool types
- * Fix false positive in [`redundant_closure`] pertaining to differences in borrows
- * Fix false positive in [`option_map_unwrap_or`] on non-copy types
- * Fix false positives in [`missing_const_for_fn`] pertaining to macros and trait method impls
- * Fix false positive in [`needless_pass_by_value`] pertaining to procedural macros
- * Fix false positive in [`needless_continue`] pertaining to loop labels
- * Fix false positive for [`boxed_local`] pertaining to arguments moved into closures
- * Fix false positive for [`use_self`] in nested functions
- * Fix suggestion for [`expect_fun_call`] (https://github.com/rust-lang/rust-clippy/pull/3846)
- * Fix suggestion for [`explicit_counter_loop`] to deal with parenthesizing range variables
- * Fix suggestion for [`single_char_pattern`] to correctly escape single quotes
- * Avoid triggering [`redundant_closure`] in macros
- * ICE fixes: [#3805](https://github.com/rust-lang/rust-clippy/pull/3805), [#3772](https://github.com/rust-lang/rust-clippy/pull/3772), [#3741](https://github.com/rust-lang/rust-clippy/pull/3741)
+* New lint: [`drop_bounds`] to detect `T: Drop` bounds
+* Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101)
+* Rename `cyclomatic_complexity` to [`cognitive_complexity`], start work on making lint more practical for Rust code
+* Move [`get_unwrap`] to the restriction category
+* Improve suggestions for [`iter_cloned_collect`]
+* Improve suggestions for [`cast_lossless`] to suggest suffixed literals
+* Fix false positives in [`print_with_newline`] and [`write_with_newline`] pertaining to raw strings
+* Fix false positive in [`needless_range_loop`] pertaining to structs without a `.iter()`
+* Fix false positive in [`bool_comparison`] pertaining to non-bool types
+* Fix false positive in [`redundant_closure`] pertaining to differences in borrows
+* Fix false positive in [`option_map_unwrap_or`] on non-copy types
+* Fix false positives in [`missing_const_for_fn`] pertaining to macros and trait method impls
+* Fix false positive in [`needless_pass_by_value`] pertaining to procedural macros
+* Fix false positive in [`needless_continue`] pertaining to loop labels
+* Fix false positive for [`boxed_local`] pertaining to arguments moved into closures
+* Fix false positive for [`use_self`] in nested functions
+* Fix suggestion for [`expect_fun_call`] (https://github.com/rust-lang/rust-clippy/pull/3846)
+* Fix suggestion for [`explicit_counter_loop`] to deal with parenthesizing range variables
+* Fix suggestion for [`single_char_pattern`] to correctly escape single quotes
+* Avoid triggering [`redundant_closure`] in macros
+* ICE fixes: [#3805](https://github.com/rust-lang/rust-clippy/pull/3805), [#3772](https://github.com/rust-lang/rust-clippy/pull/3772), [#3741](https://github.com/rust-lang/rust-clippy/pull/3741)
## Rust 1.34
@@ -551,7 +551,7 @@ Released 2018-09-13
## 0.0.181
* Rustup to *rustc 1.25.0-nightly (97520ccb1 2018-01-21)*
* New lints: [`else_if_without_else`], [`option_option`], [`unit_arg`], [`unnecessary_fold`]
-* Removed [`unit_expr`]
+* Removed `unit_expr`
* Various false positive fixes for [`needless_pass_by_value`]
## 0.0.180
@@ -597,11 +597,13 @@ Released 2018-09-13
## 0.0.167
* Rustup to *rustc 1.23.0-nightly (90ef3372e 2017-10-29)*
-* New lints: [`const_static_lifetime`], [`erasing_op`], [`fallible_impl_from`], [`println_empty_string`], [`useless_asref`]
+* New lints: `const_static_lifetime`, [`erasing_op`], [`fallible_impl_from`], [`println_empty_string`], [`useless_asref`]
## 0.0.166
* Rustup to *rustc 1.22.0-nightly (b7960878b 2017-10-18)*
-* New lints: [`explicit_write`], [`identity_conversion`], [`implicit_hasher`], [`invalid_ref`], [`option_map_or_none`], [`range_minus_one`], [`range_plus_one`], [`transmute_int_to_bool`], [`transmute_int_to_char`], [`transmute_int_to_float`]
+* New lints: [`explicit_write`], [`identity_conversion`], [`implicit_hasher`], [`invalid_ref`], [`option_map_or_none`],
+ [`range_minus_one`], [`range_plus_one`], [`transmute_int_to_bool`], [`transmute_int_to_char`],
+ [`transmute_int_to_float`]
## 0.0.165
* Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
@@ -636,7 +638,7 @@ Released 2018-09-13
## 0.0.157 - 2017-09-04
* Update to *rustc 1.22.0-nightly (981ce7d8d 2017-09-03)*
-* New lint: [`unit_expr`]
+* New lint: `unit_expr`
## 0.0.156 - 2017-09-03
* Update to *rustc 1.22.0-nightly (744dd6c1d 2017-09-02)*
@@ -884,7 +886,7 @@ Released 2018-09-13
lint groups: [`filter_next`], [`for_loop_over_option`],
[`for_loop_over_result`] and [`match_overlapping_arm`]. You should now be
able to `#[allow/deny]` them individually and they are available directly
- through [`cargo clippy`].
+ through `cargo clippy`.
## 0.0.87 — 2016-08-31
* Rustup to *rustc 1.13.0-nightly (eac41469d 2016-08-30)*
@@ -897,7 +899,7 @@ Released 2018-09-13
## 0.0.85 — 2016-08-19
* Fix ICE with [`useless_attribute`]
-* [`useless_attribute`] ignores [`unused_imports`] on `use` statements
+* [`useless_attribute`] ignores `unused_imports` on `use` statements
## 0.0.84 — 2016-08-18
* Rustup to *rustc 1.13.0-nightly (aef6971ca 2016-08-17)*
@@ -936,7 +938,7 @@ Released 2018-09-13
## 0.0.77 — 2016-06-21
* Rustup to *rustc 1.11.0-nightly (5522e678b 2016-06-20)*
-* New lints: [`stutter`] and [`iter_nth`]
+* New lints: `stutter` and [`iter_nth`]
## 0.0.76 — 2016-06-10
* Rustup to *rustc 1.11.0-nightly (7d2f75a95 2016-06-09)*
@@ -1056,6 +1058,7 @@ Released 2018-09-13
[pull3665]: https://github.com/rust-lang/rust-clippy/pull/3665
[adding_lints]: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md
+
[`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index d70b2b52aca1..dec13e44a17f 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -6,35 +6,65 @@ A version of this document [can be found online](https://www.rust-lang.org/condu
**Contact**: [rust-mods@rust-lang.org](mailto:rust-mods@rust-lang.org)
-* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
-* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
+* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience,
+ gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
+ religion, nationality, or other similar characteristic.
+* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and
+ welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
-* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
-* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
-* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the Citizen Code of Conduct; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
-* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
+* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and
+ numerous costs. There is seldom a right answer.
+* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and
+ see how it works.
+* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We
+ interpret the term "harassment" as including the definition in the Citizen
+ Code of Conduct; if you have any lack of clarity about what might be included in that concept, please read their
+ definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
+* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or
+ made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation
+ team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a
+ safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
## Moderation
-These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, please contact the [Rust moderation team][mod_team].
+These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation,
+please contact the [Rust moderation team][mod_team].
-1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
+1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks,
+ are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
3. Moderators will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
-6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
-7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.
-8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.
+6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended
+ party a genuine apology.
+7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a
+ different moderator, **in private**. Complaints about bans in-channel are not allowed.
+8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate
+ situation, they should expect less leeway than others.
-In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.
+In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically
+unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly
+if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can
+drive people away from the community entirely.
-And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
+And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was
+they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good
+there was something you could've communicated better — remember that it's your responsibility to make your fellow
+Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about
+cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their
+trust.
-The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
+The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust,
+#rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo);
+GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org
+(users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the
+maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider
+explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
-*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
+*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the
+[Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
[mod_team]: https://www.rust-lang.org/team.html#Moderation-team
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4a828051185f..4d5da53e5bb7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,12 +2,14 @@
Hello fellow Rustacean! Great to see your interest in compiler internals and lints!
-**First**: if you're unsure or afraid of _anything_, just ask or submit the issue or pull request anyway. You won't be yelled at for giving it your best effort. The worst that can happen is that you'll be politely asked to change something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that.
+**First**: if you're unsure or afraid of _anything_, just ask or submit the issue or pull request anyway. You won't be
+yelled at for giving it your best effort. The worst that can happen is that you'll be politely asked to change
+something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that.
-Clippy welcomes contributions from everyone. There are many ways to contribute to Clippy and the following document explains how
-you can contribute and how to get started.
-If you have any questions about contributing or need help with anything, feel free to ask questions on issues or
-visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in `#clippy` on [Discord](https://discord.gg/rust-lang).
+Clippy welcomes contributions from everyone. There are many ways to contribute to Clippy and the following document
+explains how you can contribute and how to get started. If you have any questions about contributing or need help with
+anything, feel free to ask questions on issues or visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in
+`#clippy` on [Discord](https://discord.gg/rust-lang).
All contributors are expected to follow the [Rust Code of Conduct](http://www.rust-lang.org/conduct.html).
@@ -49,12 +51,12 @@ matching of the syntax tree structure, and are generally easier than
[`T-middle`](https://github.com/rust-lang/rust-clippy/labels/T-middle) issues, which involve types
and resolved paths.
-[`T-AST`](https://github.com/rust-lang/rust-clippy/labels/T-AST) issues will generally need you to match against a predefined syntax structure. To figure out
-how this syntax structure is encoded in the AST, it is recommended to run `rustc -Z ast-json` on an
-example of the structure and compare with the
-[nodes in the AST docs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast). Usually
-the lint will end up to be a nested series of matches and ifs,
-[like so](https://github.com/rust-lang/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34).
+[`T-AST`](https://github.com/rust-lang/rust-clippy/labels/T-AST) issues will generally need you to match against a
+predefined syntax structure. To figure out how this syntax structure is encoded in the AST, it is recommended to run
+`rustc -Z ast-json` on an example of the structure and compare with the [nodes in the AST
+docs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast). Usually the lint will end up to be a nested series of
+matches and ifs, [like
+so](https://github.com/rust-lang/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34).
[`E-medium`](https://github.com/rust-lang/rust-clippy/labels/E-medium) issues are generally
pretty easy too, though it's recommended you work on an E-easy issue first. They are mostly classified
@@ -68,9 +70,9 @@ an AST expression). `match_def_path()` in Clippy's `utils` module can also be us
## Writing code
-Have a look at the [docs for writing lints](doc/adding_lints.md) for more details. [Llogiq's blog post on lints](https://llogiq.github.io/2015/06/04/workflows.html) is also a nice primer
-to lint-writing, though it does get into advanced stuff and may be a bit
-outdated.
+Have a look at the [docs for writing lints](doc/adding_lints.md) for more details. [Llogiq's blog post on
+lints](https://llogiq.github.io/2015/06/04/workflows.html) is also a nice primer to lint-writing, though it does get
+into advanced stuff and may be a bit outdated.
If you want to add a new lint or change existing ones apart from bugfixing, it's
also a good idea to give the [stability guarantees][rfc_stability] and
@@ -79,9 +81,11 @@ quick read.
## How Clippy works
-Clippy is a [rustc compiler plugin][compiler_plugin]. The main entry point is at [`src/lib.rs`][main_entry]. In there, the lint registration is delegated to the [`clippy_lints`][lint_crate] crate.
+Clippy is a [rustc compiler plugin][compiler_plugin]. The main entry point is at [`src/lib.rs`][main_entry]. In there,
+the lint registration is delegated to the [`clippy_lints`][lint_crate] crate.
-[`clippy_lints/src/lib.rs`][lint_crate_entry] imports all the different lint modules and registers them with the rustc plugin registry. For example, the [`else_if_without_else`][else_if_without_else] lint is registered like this:
+[`clippy_lints/src/lib.rs`][lint_crate_entry] imports all the different lint modules and registers them with the rustc
+plugin registry. For example, the [`else_if_without_else`][else_if_without_else] lint is registered like this:
```rust
// ./clippy_lints/src/lib.rs
@@ -103,9 +107,12 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry) {
}
```
-The [`plugin::PluginRegistry`][plugin_registry] provides two methods to register lints: [register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass].
-Both take an object that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in every single lint.
-It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerated by `cargo dev update_lints` and you don't have to add anything by hand. When you are writing your own lint, you can use that script to save you some time.
+The [`plugin::PluginRegistry`][plugin_registry] provides two methods to register lints:
+[register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass]. Both take an object
+that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in
+every single lint. It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerated by `cargo dev
+update_lints` and you don't have to add anything by hand. When you are writing your own lint, you can use that script to
+save you some time.
```rust
// ./clippy_lints/src/else_if_without_else.rs
@@ -123,18 +130,25 @@ impl EarlyLintPass for ElseIfWithoutElse {
}
```
-The difference between `EarlyLintPass` and `LateLintPass` is that the methods of the `EarlyLintPass` trait only provide AST information. The methods of the `LateLintPass` trait are executed after type checking and contain type information via the `LateContext` parameter.
+The difference between `EarlyLintPass` and `LateLintPass` is that the methods of the `EarlyLintPass` trait only provide
+AST information. The methods of the `LateLintPass` trait are executed after type checking and contain type information
+via the `LateContext` parameter.
-That's why the `else_if_without_else` example uses the `register_early_lint_pass` function. Because the [actual lint logic][else_if_without_else] does not depend on any type information.
+That's why the `else_if_without_else` example uses the `register_early_lint_pass` function. Because the [actual lint
+logic][else_if_without_else] does not depend on any type information.
## Fixing build failures caused by Rust
-Clippy will sometimes fail to build from source because building it depends on unstable internal Rust features. Most of the times we have to adapt to the changes and only very rarely there's an actual bug in Rust. Fixing build failures caused by Rust updates, can be a good way to learn about Rust internals.
+Clippy will sometimes fail to build from source because building it depends on unstable internal Rust features. Most of
+the times we have to adapt to the changes and only very rarely there's an actual bug in Rust. Fixing build failures
+caused by Rust updates, can be a good way to learn about Rust internals.
-In order to find out why Clippy does not work properly with a new Rust commit, you can use the [rust-toolstate commit history][toolstate_commit_history].
-You will then have to look for the last commit that contains `test-pass -> build-fail` or `test-pass` -> `test-fail` for the `clippy-driver` component. [Here][toolstate_commit] is an example.
+In order to find out why Clippy does not work properly with a new Rust commit, you can use the [rust-toolstate commit
+history][toolstate_commit_history]. You will then have to look for the last commit that contains `test-pass ->
+build-fail` or `test-pass` -> `test-fail` for the `clippy-driver` component. [Here][toolstate_commit] is an example.
-The commit message contains a link to the PR. The PRs are usually small enough to discover the breaking API change and if they are bigger, they likely include some discussion that may help you to fix Clippy.
+The commit message contains a link to the PR. The PRs are usually small enough to discover the breaking API change and
+if they are bigger, they likely include some discussion that may help you to fix Clippy.
To check if Clippy is available for a specific target platform, you can check
the [rustup component history][rustup_component_history].
diff --git a/Cargo.toml b/Cargo.toml
index 84b96a329140..aefbcec15f51 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,7 @@ publish = false
[badges]
travis-ci = { repository = "rust-lang/rust-clippy" }
appveyor = { repository = "rust-lang/rust-clippy" }
+# FIXME(flip1995): Add GHA badge once rust-lang/crates.io#1838 is merged
[[bin]]
name = "cargo-clippy"
diff --git a/README.md b/README.md
index 96584dfef5c6..284dda731405 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
[![Build Status](https://travis-ci.com/rust-lang/rust-clippy.svg?branch=master)](https://travis-ci.com/rust-lang/rust-clippy)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/id677xpw1dguo7iw?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/rust-clippy)
+[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test/badge.svg?branch=master&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test%22+event%3Apush+branch%3Amaster)
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license)
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
@@ -30,7 +31,9 @@ Only the following of those categories are enabled by default:
Other categories need to be enabled in order for their lints to be executed.
-The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also contains "restriction lints", which are for things which are usually not considered "bad", but may be useful to turn on in specific cases. These should be used very selectively, if at all.
+The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also contains "restriction lints", which are
+for things which are usually not considered "bad", but may be useful to turn on in specific cases. These should be used
+very selectively, if at all.
Table of contents:
@@ -140,15 +143,16 @@ line. (You can swap `clippy::all` with the specific lint category you are target
## Configuration
-Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a basic `variable = value` mapping eg.
+Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a basic `variable =
+value` mapping eg.
```toml
blacklisted-names = ["toto", "tata", "titi"]
cognitive-complexity-threshold = 30
```
-See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which lints can be configured and the
-meaning of the variables.
+See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which
+lints can be configured and the meaning of the variables.
To deactivate the “for further information visit *lint-link*” message you can
define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
@@ -169,7 +173,10 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints:
Note: `deny` produces errors instead of warnings.
-If you do not want to include your lint levels in your code, you can globally enable/disable lints by passing extra flags to Clippy during the run: `cargo clippy -- -A clippy::lint_name` will run Clippy with `lint_name` disabled and `cargo clippy -- -W clippy::lint_name` will run it with that enabled. This also works with lint groups. For example you can run Clippy with warnings for all lints enabled: `cargo clippy -- -W clippy::pedantic`
+If you do not want to include your lint levels in your code, you can globally enable/disable lints by passing extra
+flags to Clippy during the run: `cargo clippy -- -A clippy::lint_name` will run Clippy with `lint_name` disabled and
+`cargo clippy -- -W clippy::lint_name` will run it with that enabled. This also works with lint groups. For example you
+can run Clippy with warnings for all lints enabled: `cargo clippy -- -W clippy::pedantic`
## Contributing
diff --git a/clippy_dummy/PUBLISH.md b/clippy_dummy/PUBLISH.md
index 535f11bd2ee4..8e420ec959a2 100644
--- a/clippy_dummy/PUBLISH.md
+++ b/clippy_dummy/PUBLISH.md
@@ -1,4 +1,6 @@
-This is a dummy crate to publish to crates.io. It primarily exists to ensure that folks trying to install clippy from crates.io get redirected to the `rustup` technique.
+This is a dummy crate to publish to crates.io. It primarily exists to ensure
+that folks trying to install clippy from crates.io get redirected to the
+`rustup` technique.
-Before publishing, be sure to rename `clippy_dummy` to `clippy` in `Cargo.toml`, it has a different name to avoid workspace issues.
-
\ No newline at end of file
+Before publishing, be sure to rename `clippy_dummy` to `clippy` in `Cargo.toml`,
+it has a different name to avoid workspace issues.
diff --git a/doc/adding_lints.md b/doc/adding_lints.md
index 99178c2d75b9..8c8784f0e00f 100644
--- a/doc/adding_lints.md
+++ b/doc/adding_lints.md
@@ -167,12 +167,12 @@ declare_clippy_lint! {
```
* The section of lines prefixed with `///` constitutes the lint documentation
-section. This is the default documentation style and will be displayed at
-https://rust-lang.github.io/rust-clippy/master/index.html.
+ section. This is the default documentation style and will be displayed at
+ https://rust-lang.github.io/rust-clippy/master/index.html.
* `FOO_FUNCTIONS` is the name of our lint. Be sure to follow the [lint naming
-guidelines][lint_naming] here when naming your lint. In short, the name should
-state the thing that is being checked for and read well when used with
-`allow`/`warn`/`deny`.
+ guidelines][lint_naming] here when naming your lint. In short, the name should
+ state the thing that is being checked for and read well when used with
+ `allow`/`warn`/`deny`.
* `pedantic` sets the lint level to `Allow`.
The exact mapping can be found [here][category_level_mapping]
* The last part should be a text that explains what exactly is wrong with the
@@ -443,7 +443,6 @@ don't hesitate to ask on Discord, IRC or in the issue/PR.
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
[category_level_mapping]: https://github.com/rust-lang/rust-clippy/blob/bd23cb89ec0ea63403a17d3fc5e50c88e38dd54f/clippy_lints/src/lib.rs#L43
[declare_clippy_lint]: https://github.com/rust-lang/rust-clippy/blob/a71acac1da7eaf667ab90a1d65d10e5cc4b80191/clippy_lints/src/lib.rs#L39
-[compilation_stages]: https://rust-lang.github.io/rustc-guide/high-level-overview.html#the-main-stages-of-compilation
[check_fn]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.EarlyLintPass.html#method.check_fn
[early_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.EarlyLintPass.html
[late_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.LateLintPass.html
diff --git a/etc/relicense/RELICENSE_DOCUMENTATION.md b/etc/relicense/RELICENSE_DOCUMENTATION.md
index 847e66e65e35..fcd7abbf3f16 100644
--- a/etc/relicense/RELICENSE_DOCUMENTATION.md
+++ b/etc/relicense/RELICENSE_DOCUMENTATION.md
@@ -1,36 +1,69 @@
-This repository was previously licensed under MPL-2.0, however in #3093 ([archive](http://web.archive.org/web/20181005185227/https://github.com/rust-lang-nursery/rust-clippy/issues/3093), [screenshot](https://user-images.githubusercontent.com/1617736/46573505-5b856880-c94b-11e8-9a14-981c889b4981.png)) we relicensed it to the Rust license (dual licensed as Apache v2 / MIT)
+This repository was previously licensed under MPL-2.0, however in #3093
+([archive](http://web.archive.org/web/20181005185227/https://github.com/rust-lang-nursery/rust-clippy/issues/3093),
+[screenshot](https://user-images.githubusercontent.com/1617736/46573505-5b856880-c94b-11e8-9a14-981c889b4981.png)) we
+relicensed it to the Rust license (dual licensed as Apache v2 / MIT)
At the time, the contributors were those listed in contributors.txt.
-We opened a bunch of issues asking for an explicit relicensing approval. Screenshots of all these issues at the time of relicensing are archived on GitHub. We also have saved Wayback Machine copies of these:
+We opened a bunch of issues asking for an explicit relicensing approval. Screenshots of all these issues at the time of
+relicensing are archived on GitHub. We also have saved Wayback Machine copies of these:
- - #3094 ([archive](http://web.archive.org/web/20181005191247/https://github.com/rust-lang-nursery/rust-clippy/issues/3094), [screenshot](https://user-images.githubusercontent.com/1617736/46573506-5b856880-c94b-11e8-8a44-51cb40bc16ee.png))
- - #3095 ([archive](http://web.archive.org/web/20181005184416/https://github.com/rust-lang-nursery/rust-clippy/issues/3095), [screenshot](https://user-images.githubusercontent.com/1617736/46573507-5c1dff00-c94b-11e8-912a-4bd6b5f838f5.png))
- - #3096 ([archive](http://web.archive.org/web/20181005184802/https://github.com/rust-lang-nursery/rust-clippy/issues/3096), [screenshot](https://user-images.githubusercontent.com/1617736/46573508-5c1dff00-c94b-11e8-9425-2464f7260ff0.png))
- - #3097 ([archive](http://web.archive.org/web/20181005184821/https://github.com/rust-lang-nursery/rust-clippy/issues/3097), [screenshot](https://user-images.githubusercontent.com/1617736/46573509-5c1dff00-c94b-11e8-8ba2-53f687984fe7.png))
- - #3098 ([archive](http://web.archive.org/web/20181005184900/https://github.com/rust-lang-nursery/rust-clippy/issues/3098), [screenshot](https://user-images.githubusercontent.com/1617736/46573510-5c1dff00-c94b-11e8-8f64-371698401c60.png))
- - #3099 ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3099), [screenshot](https://user-images.githubusercontent.com/1617736/46573511-5c1dff00-c94b-11e8-8e20-7d0eeb392b95.png))
- - #3100 ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3100), [screenshot](https://user-images.githubusercontent.com/1617736/46573512-5c1dff00-c94b-11e8-8a13-7d758ed3563d.png))
- - #3230 ([archive](http://web.archive.org/web/20181005184903/https://github.com/rust-lang-nursery/rust-clippy/issues/3230), [screenshot](https://user-images.githubusercontent.com/1617736/46573513-5cb69580-c94b-11e8-86b1-14ce82741e5c.png))
+- #3094
+ ([archive](http://web.archive.org/web/20181005191247/https://github.com/rust-lang-nursery/rust-clippy/issues/3094),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573506-5b856880-c94b-11e8-8a44-51cb40bc16ee.png))
+- #3095
+ ([archive](http://web.archive.org/web/20181005184416/https://github.com/rust-lang-nursery/rust-clippy/issues/3095),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573507-5c1dff00-c94b-11e8-912a-4bd6b5f838f5.png))
+- #3096
+ ([archive](http://web.archive.org/web/20181005184802/https://github.com/rust-lang-nursery/rust-clippy/issues/3096),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573508-5c1dff00-c94b-11e8-9425-2464f7260ff0.png))
+- #3097
+ ([archive](http://web.archive.org/web/20181005184821/https://github.com/rust-lang-nursery/rust-clippy/issues/3097),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573509-5c1dff00-c94b-11e8-8ba2-53f687984fe7.png))
+- #3098
+ ([archive](http://web.archive.org/web/20181005184900/https://github.com/rust-lang-nursery/rust-clippy/issues/3098),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573510-5c1dff00-c94b-11e8-8f64-371698401c60.png))
+- #3099
+ ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3099),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573511-5c1dff00-c94b-11e8-8e20-7d0eeb392b95.png))
+- #3100
+ ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3100),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573512-5c1dff00-c94b-11e8-8a13-7d758ed3563d.png))
+- #3230
+ ([archive](http://web.archive.org/web/20181005184903/https://github.com/rust-lang-nursery/rust-clippy/issues/3230),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573513-5cb69580-c94b-11e8-86b1-14ce82741e5c.png))
The usernames of commenters on these issues can be found in relicense_comments.txt
There are a couple people in relicense_comments.txt who are not found in contributors.txt:
- - @EpocSquadron has [made minor text contributions to the README](https://github.com/rust-lang/rust-clippy/commits?author=EpocSquadron) which have since been overwritten, and doesn't count
- - @JayKickliter [agreed to the relicense on their pull request](https://github.com/rust-lang/rust-clippy/pull/3195#issuecomment-423781016) ([archive](https://web.archive.org/web/20181005190730/https://github.com/rust-lang/rust-clippy/pull/3195), [screenshot](https://user-images.githubusercontent.com/1617736/46573514-5cb69580-c94b-11e8-8ffb-05a5bd02e2cc.png)
-)
- - @sanmai-NL's [contribution](https://github.com/rust-lang/rust-clippy/commits?author=sanmai-NL) is a minor one-word addition which doesn't count for copyright assignment
- - @zmt00's [contributions](https://github.com/rust-lang/rust-clippy/commits?author=zmt00) are minor typo fixes and don't count
- - @VKlayd has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=VKlayd) which we rewrote (see below)
- - @wartman4404 has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=wartman4404) which we rewrote (see below)
+- @EpocSquadron has [made minor text contributions to the
+ README](https://github.com/rust-lang/rust-clippy/commits?author=EpocSquadron) which have since been overwritten, and
+ doesn't count
+- @JayKickliter [agreed to the relicense on their pull
+ request](https://github.com/rust-lang/rust-clippy/pull/3195#issuecomment-423781016)
+ ([archive](https://web.archive.org/web/20181005190730/https://github.com/rust-lang/rust-clippy/pull/3195),
+ [screenshot](https://user-images.githubusercontent.com/1617736/46573514-5cb69580-c94b-11e8-8ffb-05a5bd02e2cc.png)
+- @sanmai-NL's [contribution](https://github.com/rust-lang/rust-clippy/commits?author=sanmai-NL) is a minor one-word
+ addition which doesn't count for copyright assignment
+- @zmt00's [contributions](https://github.com/rust-lang/rust-clippy/commits?author=zmt00) are minor typo fixes and don't
+ count
+- @VKlayd has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=VKlayd) which we rewrote
+ (see below)
+- @wartman4404 has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=wartman4404) which
+ we rewrote (see below)
-Two of these contributors had nonminor contributions (#2184, #427) requiring a rewrite, carried out in #3251 ([archive](http://web.archive.org/web/20181005192411/https://github.com/rust-lang-nursery/rust-clippy/pull/3251), [screenshot](https://user-images.githubusercontent.com/1617736/46573515-5cb69580-c94b-11e8-86e5-b456452121b2.png)
-)
-First, I (Manishearth) removed the lints they had added. I then documented at a high level what the lints did in #3251, asking for co-maintainers who had not seen the code for the lints to rewrite them. #2814 was rewritten by @phansch, and #427 was rewritten by @oli-obk, who did not recall having previously seen the code they were rewriting.
+Two of these contributors had nonminor contributions (#2184, #427) requiring a rewrite, carried out in #3251
+([archive](http://web.archive.org/web/20181005192411/https://github.com/rust-lang-nursery/rust-clippy/pull/3251),
+[screenshot](https://user-images.githubusercontent.com/1617736/46573515-5cb69580-c94b-11e8-86e5-b456452121b2.png))
+
+First, I (Manishearth) removed the lints they had added. I then documented at a high level what the lints did in #3251,
+asking for co-maintainers who had not seen the code for the lints to rewrite them. #2814 was rewritten by @phansch, and
+#427 was rewritten by @oli-obk, who did not recall having previously seen the code they were rewriting.
------
-Since this document was written, @JayKickliter and @sanmai-ML added their consent in #3230 ([archive](http://web.archive.org/web/20181006171926/https://github.com/rust-lang-nursery/rust-clippy/issues/3230))
+Since this document was written, @JayKickliter and @sanmai-ML added their consent in #3230
+([archive](http://web.archive.org/web/20181006171926/https://github.com/rust-lang-nursery/rust-clippy/issues/3230))
diff --git a/src/driver.rs b/src/driver.rs
index 27ff7fa9116e..f6c2411ee5b1 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -281,6 +281,17 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
}
}
+fn toolchain_path(home: Option, toolchain: Option) -> Option {
+ home.and_then(|home| {
+ toolchain.map(|toolchain| {
+ let mut path = PathBuf::from(home);
+ path.push("toolchains");
+ path.push(toolchain);
+ path
+ })
+ })
+}
+
pub fn main() {
rustc_driver::init_rustc_env_logger();
lazy_static::initialize(&ICE_HOOK);
@@ -301,22 +312,21 @@ pub fn main() {
// - RUSTUP_HOME, MULTIRUST_HOME, RUSTUP_TOOLCHAIN, MULTIRUST_TOOLCHAIN
// - sysroot from rustc in the path
// - compile-time environment
+ // - SYSROOT
+ // - RUSTUP_HOME, MULTIRUST_HOME, RUSTUP_TOOLCHAIN, MULTIRUST_TOOLCHAIN
let sys_root_arg = arg_value(&orig_args, "--sysroot", |_| true);
let have_sys_root_arg = sys_root_arg.is_some();
let sys_root = sys_root_arg
.map(PathBuf::from)
.or_else(|| std::env::var("SYSROOT").ok().map(PathBuf::from))
.or_else(|| {
- let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
- let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN"));
- home.and_then(|home| {
- toolchain.map(|toolchain| {
- let mut path = PathBuf::from(home);
- path.push("toolchains");
- path.push(toolchain);
- path
- })
- })
+ let home = std::env::var("RUSTUP_HOME")
+ .or_else(|_| std::env::var("MULTIRUST_HOME"))
+ .ok();
+ let toolchain = std::env::var("RUSTUP_TOOLCHAIN")
+ .or_else(|_| std::env::var("MULTIRUST_TOOLCHAIN"))
+ .ok();
+ toolchain_path(home, toolchain)
})
.or_else(|| {
Command::new("rustc")
@@ -328,6 +338,15 @@ pub fn main() {
.map(|s| PathBuf::from(s.trim()))
})
.or_else(|| option_env!("SYSROOT").map(PathBuf::from))
+ .or_else(|| {
+ let home = option_env!("RUSTUP_HOME")
+ .or(option_env!("MULTIRUST_HOME"))
+ .map(ToString::to_string);
+ let toolchain = option_env!("RUSTUP_TOOLCHAIN")
+ .or(option_env!("MULTIRUST_TOOLCHAIN"))
+ .map(ToString::to_string);
+ toolchain_path(home, toolchain)
+ })
.map(|pb| pb.to_string_lossy().to_string())
.expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust");
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index 7cfbfcf16a99..ffda650ec00e 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -48,7 +48,7 @@ fn default_config() -> compiletest::Config {
));
config.build_base = if rustc_test_suite().is_some() {
- // we don't need access to the stderr files on travis
+ // we don't need access to the stderr files on CI
let mut path = PathBuf::from(env!("OUT_DIR"));
path.push("test_build_base");
path
diff --git a/tests/fmt.rs b/tests/fmt.rs
index 2e33c3ed5e5b..3aff8741f605 100644
--- a/tests/fmt.rs
+++ b/tests/fmt.rs
@@ -3,7 +3,7 @@ use std::process::Command;
#[test]
fn fmt() {
- if option_env!("RUSTC_TEST_SUITE").is_some() {
+ if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() {
return;
}
diff --git a/tests/integration.rs b/tests/integration.rs
index d14ced8ad4e7..74f9a854dc1f 100644
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -59,6 +59,10 @@ fn integration_test() {
panic!("query stack during panic in the output");
} else if stderr.contains("E0463") {
panic!("error: E0463");
+ } else if stderr.contains("E0514") {
+ panic!("incompatible crate versions");
+ } else if stderr.contains("failed to run `rustc` to learn about target-specific information") {
+ panic!("couldn't find librustc_driver, consider setting `LD_LIBRARY_PATH`");
}
match output.status.code() {
diff --git a/util/export.py b/util/export.py
index e8fc4d84ea4f..5d1bd60acf3d 100755
--- a/util/export.py
+++ b/util/export.py
@@ -71,7 +71,9 @@ def main():
outfile = sys.argv[1] if len(sys.argv) > 1 else "util/gh-pages/lints.json"
with open(outfile, "w") as fp:
- json.dump(list(lints.values()), fp, indent=2)
+ lints = list(lints.values())
+ lints.sort(key=lambda x: x['id'])
+ json.dump(lints, fp, indent=2)
log.info("wrote JSON for great justice")