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
flip1995 committed Jul 15, 2022
2 parents 6dc9746 + 0f5a38f commit f074034
Show file tree
Hide file tree
Showing 170 changed files with 3,132 additions and 969 deletions.
12 changes: 8 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ Thank you for making Clippy better!
We're collecting our changelog from pull request descriptions.
If your PR only includes internal changes, you can just write
`changelog: none`. Otherwise, please write a short comment
explaining your change. Also, it's helpful for us that
the lint name is put into brackets `[]` and backticks `` ` ` ``,
e.g. ``[`lint_name`]``.
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
It's also helpful for us that the lint name is put within backticks (`` ` ` ``),
and then encapsulated by square brackets (`[]`), for example:
```
changelog: [`lint_name`]: your change
```

If your PR fixes an issue, you can add `fixes #issue_number` into this
PR description. This way the issue will be automatically closed when
your PR is merged.

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
OS: ${{ runner.os }}

metadata_collection:
needs: base
needs: changelog
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
name: bors test finished
if: github.event.pusher.name == 'bors' && success()
runs-on: ubuntu-latest
needs: [changelog, base, integration_build, integration]
needs: [changelog, base, metadata_collection, integration_build, integration]

steps:
- name: Mark the job as successful
Expand All @@ -274,7 +274,7 @@ jobs:
name: bors test finished
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
runs-on: ubuntu-latest
needs: [changelog, base, integration_build, integration]
needs: [changelog, base, metadata_collection, integration_build, integration]

steps:
- name: Mark the job as a failure
Expand Down
172 changes: 165 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,173 @@
# Changelog

All notable changes to this project will be documented in this file.
See [Changelog Update](doc/changelog_update.md) if you want to update this
See [Changelog Update](book/src/development/infrastructure/changelog_update.md) if you want to update this
document.

## Unreleased / In Rust Nightly

[d0cf3481...master](https://github.com/rust-lang/rust-clippy/compare/d0cf3481...master)
[7c21f91b...master](https://github.com/rust-lang/rust-clippy/compare/7c21f91b...master)

## Rust 1.62

Current stable, released 2022-06-30

[d0cf3481...7c21f91b](https://github.com/rust-lang/rust-clippy/compare/d0cf3481...7c21f91b)

### New Lints

* [`large_include_file`]
[#8727](https://github.com/rust-lang/rust-clippy/pull/8727)
* [`cast_abs_to_unsigned`]
[#8635](https://github.com/rust-lang/rust-clippy/pull/8635)
* [`err_expect`]
[#8606](https://github.com/rust-lang/rust-clippy/pull/8606)
* [`unnecessary_owned_empty_strings`]
[#8660](https://github.com/rust-lang/rust-clippy/pull/8660)
* [`empty_structs_with_brackets`]
[#8594](https://github.com/rust-lang/rust-clippy/pull/8594)
* [`crate_in_macro_def`]
[#8576](https://github.com/rust-lang/rust-clippy/pull/8576)
* [`needless_option_take`]
[#8665](https://github.com/rust-lang/rust-clippy/pull/8665)
* [`bytes_count_to_len`]
[#8711](https://github.com/rust-lang/rust-clippy/pull/8711)
* [`is_digit_ascii_radix`]
[#8624](https://github.com/rust-lang/rust-clippy/pull/8624)
* [`await_holding_invalid_type`]
[#8707](https://github.com/rust-lang/rust-clippy/pull/8707)
* [`trim_split_whitespace`]
[#8575](https://github.com/rust-lang/rust-clippy/pull/8575)
* [`pub_use`]
[#8670](https://github.com/rust-lang/rust-clippy/pull/8670)
* [`format_push_string`]
[#8626](https://github.com/rust-lang/rust-clippy/pull/8626)
* [`empty_drop`]
[#8571](https://github.com/rust-lang/rust-clippy/pull/8571)
* [`drop_non_drop`]
[#8630](https://github.com/rust-lang/rust-clippy/pull/8630)
* [`forget_non_drop`]
[#8630](https://github.com/rust-lang/rust-clippy/pull/8630)

### Moves and Deprecations

* Move [`only_used_in_recursion`] to `nursery` (now allow-by-default)
[#8783](https://github.com/rust-lang/rust-clippy/pull/8783)
* Move [`stable_sort_primitive`] to `pedantic` (now allow-by-default)
[#8716](https://github.com/rust-lang/rust-clippy/pull/8716)

### Enhancements

* Remove overlap between [`manual_split_once`] and [`needless_splitn`]
[#8631](https://github.com/rust-lang/rust-clippy/pull/8631)
* [`map_identity`]: Now checks for needless `map_err`
[#8487](https://github.com/rust-lang/rust-clippy/pull/8487)
* [`extra_unused_lifetimes`]: Now checks for impl lifetimes
[#8737](https://github.com/rust-lang/rust-clippy/pull/8737)
* [`cast_possible_truncation`]: Now catches more cases with larger shift or divide operations
[#8687](https://github.com/rust-lang/rust-clippy/pull/8687)
* [`identity_op`]: Now checks for modulo expressions
[#8519](https://github.com/rust-lang/rust-clippy/pull/8519)
* [`panic`]: No longer lint in constant context
[#8592](https://github.com/rust-lang/rust-clippy/pull/8592)
* [`manual_split_once`]: Now lints manual iteration of `splitn`
[#8717](https://github.com/rust-lang/rust-clippy/pull/8717)
* [`self_named_module_files`], [`mod_module_files`]: Now handle relative module paths
[#8611](https://github.com/rust-lang/rust-clippy/pull/8611)
* [`unsound_collection_transmute`]: Now has better size and alignment checks
[#8648](https://github.com/rust-lang/rust-clippy/pull/8648)
* [`unnested_or_patterns`]: Ignore cases, where the suggestion would be longer
[#8619](https://github.com/rust-lang/rust-clippy/pull/8619)

### False Positive Fixes

* [`rest_pat_in_fully_bound_structs`]: Now ignores structs marked with `#[non_exhaustive]`
[#8690](https://github.com/rust-lang/rust-clippy/pull/8690)
* [`needless_late_init`]: No longer lints `if let` statements, `let mut` bindings or instances that
changes the drop order significantly
[#8617](https://github.com/rust-lang/rust-clippy/pull/8617)
* [`unnecessary_cast`]: No longer lints to casts to aliased or non-primitive types
[#8596](https://github.com/rust-lang/rust-clippy/pull/8596)
* [`init_numbered_fields`]: No longer lints type aliases
[#8780](https://github.com/rust-lang/rust-clippy/pull/8780)
* [`needless_option_as_deref`]: No longer lints for `as_deref_mut` on `Option` values that can't be moved
[#8646](https://github.com/rust-lang/rust-clippy/pull/8646)
* [`mistyped_literal_suffixes`]: Now ignores float literals without an exponent
[#8742](https://github.com/rust-lang/rust-clippy/pull/8742)
* [`undocumented_unsafe_blocks`]: Now ignores unsafe blocks from proc-macros and works better for sub-expressions
[#8450](https://github.com/rust-lang/rust-clippy/pull/8450)
* [`same_functions_in_if_condition`]: Now allows different constants, even if they have the same value
[#8673](https://github.com/rust-lang/rust-clippy/pull/8673)
* [`needless_match`]: Now checks for more complex types and ignores type coercion
[#8549](https://github.com/rust-lang/rust-clippy/pull/8549)
* [`assertions_on_constants`]: Now ignores constants from `cfg!` macros
[#8614](https://github.com/rust-lang/rust-clippy/pull/8614)
* [`indexing_slicing`]: Fix false positives with constant indices in
[#8588](https://github.com/rust-lang/rust-clippy/pull/8588)
* [`iter_with_drain`]: Now ignores iterator references
[#8668](https://github.com/rust-lang/rust-clippy/pull/8668)
* [`useless_attribute`]: Now allows [`redundant_pub_crate`] on `use` items
[#8743](https://github.com/rust-lang/rust-clippy/pull/8743)
* [`cast_ptr_alignment`]: Now ignores expressions, when used for unaligned reads and writes
[#8632](https://github.com/rust-lang/rust-clippy/pull/8632)
* [`wrong_self_convention`]: Now allows `&mut self` and no self as arguments for `is_*` methods
[#8738](https://github.com/rust-lang/rust-clippy/pull/8738)
* [`mut_from_ref`]: Only lint in unsafe code
[#8647](https://github.com/rust-lang/rust-clippy/pull/8647)
* [`redundant_pub_crate`]: Now allows macro exports
[#8736](https://github.com/rust-lang/rust-clippy/pull/8736)
* [`needless_match`]: Ignores cases where the else block expression is different
[#8700](https://github.com/rust-lang/rust-clippy/pull/8700)
* [`transmute_int_to_char`]: Now allows transmutations in `const` code
[#8610](https://github.com/rust-lang/rust-clippy/pull/8610)
* [`manual_non_exhaustive`]: Ignores cases, where the enum value is used
[#8645](https://github.com/rust-lang/rust-clippy/pull/8645)
* [`redundant_closure`]: Now ignores coerced closure
[#8431](https://github.com/rust-lang/rust-clippy/pull/8431)
* [`identity_op`]: Is now ignored in cases where extra brackets would be needed
[#8730](https://github.com/rust-lang/rust-clippy/pull/8730)
* [`let_unit_value`]: Now ignores cases which are used for type inference
[#8563](https://github.com/rust-lang/rust-clippy/pull/8563)

### Suggestion Fixes/Improvements

* [`manual_split_once`]: Fixed incorrect suggestions for single result accesses
[#8631](https://github.com/rust-lang/rust-clippy/pull/8631)
* [`bytes_nth`]: Fix typos in the diagnostic message
[#8403](https://github.com/rust-lang/rust-clippy/pull/8403)
* [`mistyped_literal_suffixes`]: Now suggests the correct integer types
[#8742](https://github.com/rust-lang/rust-clippy/pull/8742)
* [`unnecessary_to_owned`]: Fixed suggestion based on the configured msrv
[#8692](https://github.com/rust-lang/rust-clippy/pull/8692)
* [`single_element_loop`]: Improve lint for Edition 2021 arrays
[#8616](https://github.com/rust-lang/rust-clippy/pull/8616)
* [`manual_bits`]: Now includes a cast for proper type conversion, when needed
[#8677](https://github.com/rust-lang/rust-clippy/pull/8677)
* [`option_map_unit_fn`], [`result_map_unit_fn`]: Fix some incorrect suggestions
[#8584](https://github.com/rust-lang/rust-clippy/pull/8584)
* [`collapsible_else_if`]: Add whitespace in suggestion
[#8729](https://github.com/rust-lang/rust-clippy/pull/8729)
* [`transmute_bytes_to_str`]: Now suggest `from_utf8_unchecked` in `const` context
[#8612](https://github.com/rust-lang/rust-clippy/pull/8612)
* [`map_clone`]: Improve message and suggestion based on the msrv
[#8688](https://github.com/rust-lang/rust-clippy/pull/8688)
* [`needless_late_init`]: Now shows the `let` statement where it was first initialized
[#8779](https://github.com/rust-lang/rust-clippy/pull/8779)

### ICE Fixes

* [`only_used_in_recursion`]
[#8691](https://github.com/rust-lang/rust-clippy/pull/8691)
* [`cast_slice_different_sizes`]
[#8720](https://github.com/rust-lang/rust-clippy/pull/8720)
* [`iter_overeager_cloned`]
[#8602](https://github.com/rust-lang/rust-clippy/pull/8602)
* [`undocumented_unsafe_blocks`]
[#8686](https://github.com/rust-lang/rust-clippy/pull/8686)

## Rust 1.61

Current stable, released 2022-05-19
Released 2022-05-19

[57b3c4b...d0cf3481](https://github.com/rust-lang/rust-clippy/compare/57b3c4b...d0cf3481)

Expand Down Expand Up @@ -207,7 +364,7 @@ Released 2022-04-07

* [`needless_borrow`]: Prevent mutable borrows being moved and suggest removing the borrow on method calls
[#8217](https://github.com/rust-lang/rust-clippy/pull/8217)
* [`chars_next_cmp`]: Correctly excapes the suggestion
* [`chars_next_cmp`]: Correctly escapes the suggestion
[#8376](https://github.com/rust-lang/rust-clippy/pull/8376)
* [`explicit_write`]: Add suggestions for `write!`s with format arguments
[#8365](https://github.com/rust-lang/rust-clippy/pull/8365)
Expand Down Expand Up @@ -1420,7 +1577,7 @@ Released 2021-03-25
* Add `cargo dev-lintcheck` tool to the Clippy Dev Tool
[#6469](https://github.com/rust-lang/rust-clippy/pull/6469)

[Roadmap]: https://github.com/rust-lang/rust-clippy/blob/master/doc/roadmap-2021.md
[Roadmap]: https://github.com/rust-lang/rust-clippy/blob/master/book/src/development/proposals/roadmap-2021.md
[Roadmap project page]: https://github.com/rust-lang/rust-clippy/projects/3

## Rust 1.50
Expand Down Expand Up @@ -2368,7 +2525,7 @@ Released 2019-09-26
* [`inherent_to_string_shadow_display`] [#4259](https://github.com/rust-lang/rust-clippy/pull/4259)
* [`type_repetition_in_bounds`] [#3766](https://github.com/rust-lang/rust-clippy/pull/3766)
* [`try_err`] [#4222](https://github.com/rust-lang/rust-clippy/pull/4222)
* Move `{unnnecessary,panicking}_unwrap` out of nursery [#4307](https://github.com/rust-lang/rust-clippy/pull/4307)
* Move `{unnecessary,panicking}_unwrap` out of nursery [#4307](https://github.com/rust-lang/rust-clippy/pull/4307)
* Extend the `use_self` lint to suggest uses of `Self::Variant` [#4308](https://github.com/rust-lang/rust-clippy/pull/4308)
* Improve suggestion for needless return [#4262](https://github.com/rust-lang/rust-clippy/pull/4262)
* Add auto-fixable suggestion for `let_unit` [#4337](https://github.com/rust-lang/rust-clippy/pull/4337)
Expand Down Expand Up @@ -3269,7 +3426,7 @@ Released 2018-09-13
[`AsRef`]: https://doc.rust-lang.org/std/convert/trait.AsRef.html
[configuration file]: ./rust-clippy#configuration
[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
[adding_lints]: https://github.com/rust-lang/rust-clippy/blob/master/book/src/development/adding_lints.md
[`README.md`]: https://github.com/rust-lang/rust-clippy/blob/master/README.md

<!-- lint disable no-unused-definitions -->
Expand Down Expand Up @@ -3484,6 +3641,7 @@ Released 2018-09-13
[`invalid_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_ref
[`invalid_regex`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_regex
[`invalid_upcast_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_upcast_comparisons
[`invalid_utf8_in_unchecked`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_utf8_in_unchecked
[`invisible_characters`]: https://rust-lang.github.io/rust-clippy/master/index.html#invisible_characters
[`is_digit_ascii_radix`]: https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix
[`items_after_statements`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ All contributors are expected to follow the [Rust Code of Conduct].
- [The Clippy book](#the-clippy-book)
- [High level approach](#high-level-approach)
- [Finding something to fix/improve](#finding-something-to-fiximprove)
- [Writing code](#writing-code)
- [Getting code-completion for rustc internals to work](#getting-code-completion-for-rustc-internals-to-work)
- [IntelliJ Rust](#intellij-rust)
- [Rust Analyzer](#rust-analyzer)
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ filetime = "0.2"
rustc-workspace-hack = "1.0"

# UI test dependencies
clap = { version = "3.1", features = ["derive"] }
clippy_utils = { path = "clippy_utils" }
derive-new = "0.5"
if_chain = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion book/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Clippy Book

This is the source for the Clippy Book. See the
[book](src/infrastructure/book.md) for more information.
[book](src/development/infrastructure/book.md) for more information.
10 changes: 7 additions & 3 deletions book/src/development/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This document explains the basics for hacking on Clippy. Besides others, this
includes how to build and test Clippy. For a more in depth description on the
codebase take a look at [Adding Lints] or [Common Tools].

[Adding Lints]: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md
[Common Tools]: https://github.com/rust-lang/rust-clippy/blob/master/doc/common_tools_writing_lints.md
[Adding Lints]: https://github.com/rust-lang/rust-clippy/blob/master/book/src/development/adding_lints.md
[Common Tools]: https://github.com/rust-lang/rust-clippy/blob/master/book/src/development/common_tools_writing_lints.md

- [Basics for hacking on Clippy](#basics-for-hacking-on-clippy)
- [Get the Code](#get-the-code)
Expand Down Expand Up @@ -59,7 +59,7 @@ cargo uitest
# only run UI tests starting with `test_`
TESTNAME="test_" cargo uitest
# only run dogfood tests
cargo test --test dogfood
cargo dev dogfood
```

If the output of a [UI test] differs from the expected output, you can update
Expand Down Expand Up @@ -91,10 +91,14 @@ cargo dev fmt
cargo dev update_lints
# create a new lint and register it
cargo dev new_lint
# deprecate a lint and attempt to remove code relating to it
cargo dev deprecate
# automatically formatting all code before each commit
cargo dev setup git-hook
# (experimental) Setup Clippy to work with IntelliJ-Rust
cargo dev setup intellij
# runs the `dogfood` tests
cargo dev dogfood
```

More about intellij command usage and reasons
Expand Down
3 changes: 3 additions & 0 deletions book/src/development/infrastructure/changelog_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ As section headers, we use:
Please also be sure to update the Beta/Unreleased sections at the top with the
relevant commit ranges.

If you have the time, it would be appreciated if you double-check, that the
`#[clippy::version]` attributes for the added lints contains the correct version.

[changelog]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md
[forge]: https://forge.rust-lang.org/
[rust_master_tools]: https://github.com/rust-lang/rust/tree/master/src/tools/clippy
Expand Down
2 changes: 1 addition & 1 deletion book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ For more information on configuring lint levels, see the [rustc documentation].
Clippy has lint groups which are allow-by-default. This means, that you will
have to enable the lints in those groups manually.

For a full list of all lints with their description and examples, please refere
For a full list of all lints with their description and examples, please refer
to [Clippy's lint list]. The two most important allow-by-default groups are
described below:

Expand Down
33 changes: 33 additions & 0 deletions clippy_dev/src/dogfood.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use crate::clippy_project_root;
use std::process::Command;

/// # Panics
///
/// Panics if unable to run the dogfood test
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
let mut cmd = Command::new("cargo");

cmd.current_dir(clippy_project_root())
.args(["test", "--test", "dogfood"])
.args(["--features", "internal"])
.args(["--", "dogfood_clippy"]);

let mut dogfood_args = Vec::new();
if fix {
dogfood_args.push("--fix");
}

if allow_dirty {
dogfood_args.push("--allow-dirty");
}

if allow_staged {
dogfood_args.push("--allow-staged");
}

cmd.env("__CLIPPY_DOGFOOD_ARGS", dogfood_args.join(" "));

let output = cmd.output().expect("failed to run command");

println!("{}", String::from_utf8_lossy(&output.stdout));
}
1 change: 1 addition & 0 deletions clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extern crate rustc_lexer;
use std::path::PathBuf;

pub mod bless;
pub mod dogfood;
pub mod fmt;
pub mod lint;
pub mod new_lint;
Expand Down
Loading

0 comments on commit f074034

Please sign in to comment.