Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into rustup
Browse files Browse the repository at this point in the history
  • Loading branch information
ebroto committed Oct 17, 2020
2 parents 0af467e + 4e83a38 commit bc43862
Show file tree
Hide file tree
Showing 68 changed files with 1,858 additions and 524 deletions.
12 changes: 6 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ your PR is merged.
If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `cargo dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo dev fmt`
- \[ ] Followed [lint naming conventions][lint_naming]
- \[ ] Added passing UI tests (including committed `.stderr` file)
- \[ ] `cargo test` passes locally
- \[ ] Executed `cargo dev update_lints`
- \[ ] Added lint documentation
- \[ ] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: rust-toolchain
uses: actions-rs/toolchain@v1.0.3
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
target: x86_64-unknown-linux-gnu
profile: minimal

- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

- name: Run cargo update
run: cargo update
Expand All @@ -63,7 +63,7 @@ jobs:
- 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}}"
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
- name: Build
run: cargo build --features deny-warnings
Expand Down
35 changes: 15 additions & 20 deletions .github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ env:
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
NO_FMT_TEST: 1

defaults:
run:
shell: bash

jobs:
changelog:
runs-on: ubuntu-latest
Expand All @@ -20,7 +24,7 @@ jobs:
with:
github_token: "${{ secrets.github_token }}"
- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3
with:
ref: ${{ github.ref }}

Expand Down Expand Up @@ -81,14 +85,14 @@ jobs:
if: matrix.host == 'i686-unknown-linux-gnu'

- name: rust-toolchain
uses: actions-rs/toolchain@v1.0.3
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
target: ${{ matrix.host }}
profile: minimal

- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

- name: Run cargo update
run: cargo update
Expand All @@ -105,14 +109,13 @@ jobs:
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}}"
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
- name: Link rustc dylib (MacOS)
if: runner.os == 'macOS'
run: |
Expand All @@ -122,41 +125,33 @@ jobs:
- name: Set PATH (Windows)
if: runner.os == 'Windows'
run: |
$sysroot = rustc --print sysroot
$env:PATH += ';' + $sysroot + '\bin'
echo "::set-env name=PATH::$env:PATH"
SYSROOT=$(rustc --print sysroot)
echo "$SYSROOT/bin" >> $GITHUB_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 }}

Expand All @@ -165,7 +160,7 @@ jobs:
run: |
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache
cargo cache
shell: bash
integration_build:
needs: changelog
runs-on: ubuntu-latest
Expand All @@ -177,14 +172,14 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: rust-toolchain
uses: actions-rs/toolchain@v1.0.3
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
target: x86_64-unknown-linux-gnu
profile: minimal

- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

- name: Run cargo update
run: cargo update
Expand Down Expand Up @@ -258,14 +253,14 @@ jobs:
github_token: "${{ secrets.github_token }}"

- name: rust-toolchain
uses: actions-rs/toolchain@v1.0.3
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
target: x86_64-unknown-linux-gnu
profile: minimal

- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

- name: Run cargo update
run: cargo update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clippy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
steps:
# Setup
- name: rust-toolchain
uses: actions-rs/toolchain@v1.0.3
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: nightly
target: x86_64-unknown-linux-gnu
profile: minimal
components: rustfmt

- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

# Run
- name: Build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
# Setup
- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3
with:
ref: ${{ env.TARGET_BRANCH }}
path: 'out'
Expand All @@ -34,10 +34,10 @@ jobs:
if: startswith(github.ref, 'refs/tags/')
run: |
TAG=$(basename ${{ github.ref }})
echo "::set-env name=TAG_NAME::$TAG"
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
- name: Set beta to true
if: github.ref == 'refs/heads/beta'
run: echo "::set-env name=BETA::true"
run: echo "BETA=true" >> $GITHUB_ENV

- name: Use scripts and templates from master branch
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
# Setup
- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v2.3.3

- name: Setup Node.js
uses: actions/setup-node@v1.1.0
uses: actions/setup-node@v1.4.4

- name: Install remark
run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,7 @@ Released 2018-09-13
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
[`manual_strip`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip
[`manual_swap`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap
[`manual_unwrap_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or
[`many_single_char_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names
[`map_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
[`map_entry`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
Expand Down Expand Up @@ -1892,6 +1893,7 @@ Released 2018-09-13
[`print_with_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#print_with_newline
[`println_empty_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string
[`ptr_arg`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
[`ptr_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
[`ptr_offset_with_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
[`pub_enum_variant_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names
[`question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
Expand All @@ -1917,6 +1919,7 @@ Released 2018-09-13
[`rest_pat_in_fully_bound_structs`]: https://rust-lang.github.io/rust-clippy/master/index.html#rest_pat_in_fully_bound_structs
[`result_map_or_into_option`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_map_or_into_option
[`result_map_unit_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_map_unit_fn
[`result_unit_err`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_unit_err
[`reversed_empty_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#reversed_empty_ranges
[`same_functions_in_if_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_functions_in_if_condition
[`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ path = "src/driver.rs"
# begin automatic update
clippy_lints = { version = "0.0.212", path = "clippy_lints" }
# end automatic update
semver = "0.10"
semver = "0.11"
rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util"}
tempfile = { version = "3.1.0", optional = true }
lazy_static = "1.0"

[dev-dependencies]
cargo_metadata = "0.11.1"
cargo_metadata = "0.12"
compiletest_rs = { version = "0.5.0", features = ["tmp"] }
tester = "0.7"
lazy_static = "1.0"
clippy-mini-macro-test = { version = "0.2", path = "mini-macro" }
serde = { version = "1.0", features = ["derive"] }
derive-new = "0.5"
Expand Down
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,33 @@ 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:

To disable `lint_name`, run

```terminal
cargo clippy -- -A clippy::lint_name
```

And to enable `lint_name`, run

```terminal
cargo clippy -- -W clippy::lint_name
```

This also works with lint groups. For example you
can run Clippy with warnings for all lints enabled:
```terminal
cargo clippy -- -W clippy::pedantic
```

If you care only about a single lint, you can allow all others and then explicitly reenable
the lint(s) you are interested in: `cargo clippy -- -Aclippy::all -Wclippy::useless_format -Wclippy::...`
the lint(s) you are interested in:
```terminal
cargo clippy -- -A clippy::all -W clippy::useless_format -W clippy::...
```
Note that if you've run clippy before, this may only take effect after you've modified a file or ran `cargo clean`.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion clippy_dev/src/update_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn run(update_mode: UpdateMode) {
false,
update_mode == UpdateMode::Change,
|| {
format!("pub static ref ALL_LINTS: Vec<Lint> = vec!{:#?};", sorted_usable_lints)
format!("vec!{:#?}", sorted_usable_lints)
.lines()
.map(ToString::to_string)
.collect::<Vec<_>>()
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ keywords = ["clippy", "lint", "plugin"]
edition = "2018"

[dependencies]
cargo_metadata = "0.11.1"
cargo_metadata = "0.12"
if_chain = "1.0.0"
itertools = "0.9"
pulldown-cmark = { version = "0.8", default-features = false }
Expand All @@ -27,7 +27,7 @@ serde = { version = "1.0", features = ["derive"] }
smallvec = { version = "1", features = ["union"] }
toml = "0.5.3"
unicode-normalization = "0.1"
semver = "0.10.0"
semver = "0.11"
# NOTE: cargo requires serde feat in its url dep
# see <https://github.com/rust-lang/rust/pull/63587#issuecomment-522343864>
url = { version = "2.1.0", features = ["serde"] }
Expand Down
Loading

0 comments on commit bc43862

Please sign in to comment.