Skip to content

Update Clippy #85505

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 96 commits into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
919ed2b
Fix needless_quesiton_mark false positive
camsteffen May 4, 2021
53ffe39
Use local and remapped paths where appropriate
cbeuw Apr 19, 2021
d605882
Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup
flip1995 May 6, 2021
037ddf2
Update CHANGELOG.md
flip1995 May 6, 2021
f3a0ac1
Auto merge of #7180 - flip1995:changelog, r=camsteffen
bors May 6, 2021
ab3094b
wrong_self_convention: For `to_*` variant don't lint in trait impl ta…
mgacek8 May 6, 2021
300f628
Fix clippy
scottmcm May 1, 2021
5f3aae6
Handle write!(buf, "\n") case better
th1000s May 6, 2021
91851d8
Fix duplicated "Rust 1.52" version section header
kpreid May 7, 2021
1e582c3
Auto merge of #7185 - kpreid:patch-1, r=giraffate
bors May 7, 2021
4756667
Auto merge of #7182 - mgacek8:wrong_self_convention_to__variant, r=fl…
bors May 7, 2021
af8cf94
Auto merge of #7183 - th1000s:write_nl_hint, r=flip1995
bors May 7, 2021
a21607d
needless_collect: For `BTreeMap` and `HashMap` lint only `is_empty`
mgacek8 May 5, 2021
59ccc1e
needless_collect: replace paths with diag items
mgacek8 May 5, 2021
171789e
needless_collect: Lint `LinkedList` and `BinaryHeap` in direct usage.
mgacek8 May 5, 2021
4d283ce
Fix duplicate unknown lint errors
camsteffen May 7, 2021
65951c9
Auto merge of #7165 - camsteffen:question-mark, r=Manishearth
bors May 8, 2021
1b2ca30
Move `inconsistent_struct_constructor` to pedantic
wchargin May 8, 2021
d849e95
Metadata collection monster eating deprecated lints
xFrednet May 8, 2021
98b11c8
Auto merge of #7170 - flip1995:revert_drop_order, r=llogiq
bors May 5, 2021
a8804e7
Auto merge of #85053 - camsteffen:duplicate-lint, r=davidtwco
bors May 10, 2021
72be476
Auto merge of #7203 - flip1995:beta, r=llogiq
bors May 10, 2021
c0095be
fix clippy test
RalfJung May 10, 2021
918a1a2
Auto merge of #85109 - RalfJung:remove-const_fn, r=oli-obk
bors May 11, 2021
0d4e24e
Auto merge of #7193 - wchargin:wchargin-inconsistent-struct-construct…
bors May 11, 2021
a988a90
Update clippy_lints/src/deprecated_lints.rs
xFrednet May 10, 2021
5ba236f
added `needless_bitwise_bool` lint
arya-k May 11, 2021
ab73020
Implement span quoting for proc-macros
Aaron1011 Aug 2, 2020
aa15a54
Auto merge of #7197 - xFrednet:4310-depreciated-lints-collection, r=f…
bors May 12, 2021
f019d28
Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister
bors May 12, 2021
c5a3f1c
Use () for HIR queries.
cjgillot May 11, 2021
b03b747
Use () for entry_fn.
cjgillot May 11, 2021
44c1ef8
Use () for inherent_impls.
cjgillot May 11, 2021
210ec72
Metadata collection monster searching for configurations
xFrednet May 11, 2021
88ae2d1
Metadata formatting the configuration section
xFrednet May 11, 2021
b03642e
Metadata collection clarifying default configuration values
xFrednet May 12, 2021
b740a04
Metadata collection collecting configuration deprecation reason
xFrednet May 12, 2021
4698b36
Show macro name in 'this error originates in macro' message
Aaron1011 Feb 13, 2021
0d4604d
Added `cargo collect-metadata` as a alias for the metadata collection…
xFrednet May 12, 2021
8214bf0
match_single_binding: Fix invalid suggestion when match scrutinee has…
Y-Nak Apr 16, 2021
daca50a
Improvements to `while_let_on_iterator`
Jarcho Mar 24, 2021
4713e25
Cleanup of `while_let_on_iterator`
Jarcho Apr 13, 2021
cd0db8a
Fix test comment for `while_let_on_iterator`
Jarcho May 13, 2021
cd241b3
Trigger `wrong_self_convention` only if it has implicit self
ThibsG May 13, 2021
368e621
Stop linting `else if let` pattern in `option_if_let_else` lint
ThibsG May 13, 2021
90fb7c4
Auto merge of #6966 - Jarcho:while_let_on_iterator_fp, r=xFrednet
bors May 13, 2021
1fd9975
Auto merge of #7095 - Y-Nak:match_single_binding, r=giraffate
bors May 13, 2021
b249290
needless_collect: use snippet_with_applicability
mgacek8 May 13, 2021
08ce8bb
Auto merge of #7215 - ThibsG:WrongSelfFix7179, r=Manishearth
bors May 13, 2021
10db5a6
Auto merge of #7188 - mgacek8:issue7164_needless_collect_FP, r=xFredn…
bors May 13, 2021
18c7029
Add sized trait for `wrong_self_convention` lint test
ThibsG May 13, 2021
58359b2
Auto merge of #7222 - ThibsG:WrongSelfTest, r=Manishearth
bors May 13, 2021
7d83f98
Improve match statements
ayushmishra2005 May 14, 2021
9013bf2
Addressed PR coments
ayushmishra2005 May 14, 2021
c6e0e84
Implement unnecessary-async and UI test
May 14, 2021
1d8f3b5
Unnecessary -> Unused
May 15, 2021
75ef9dc
update_lints
May 15, 2021
f810c11
Applying PR suggestions and cleaning up
xFrednet May 15, 2021
6bbee5c
Auto merge of #7217 - xFrednet:7172-metadata-collection-cargo-alias, …
bors May 16, 2021
48dad26
Auto merge of #7214 - xFrednet:7197-collecting-configuration, r=flip1…
bors May 16, 2021
c086676
Auto merge of #85178 - cjgillot:local-crate, r=oli-obk
bors May 17, 2021
44e0747
Auto merge of #7216 - ThibsG:OptionIfLetElse7006, r=llogiq
bors May 17, 2021
acdf43f
Auto merge of #7225 - InquisitivePenguin:unnessecary-async, r=llogiq
bors May 17, 2021
ebf065e
Fix a `manual_unwrap_or` FP with deref coercion
giraffate May 17, 2021
0dcde71
Fix missing variable init in lint example
arya-k May 17, 2021
2fb35ce
Add generic args for comparison in `use_self` and `useless_conversion…
ThibsG May 13, 2021
cec8d95
Auto merge of #7233 - giraffate:fix_manual_unwrap_or_fp_with_deref_co…
bors May 17, 2021
1aad754
Auto merge of #7223 - ThibsG:FpUselessConversion7205, r=camsteffen
bors May 17, 2021
b2270e1
Simplify manual_unwrap_or
camsteffen May 16, 2021
a3223af
Auto merge of #7133 - arya-k:master, r=llogiq
bors May 17, 2021
ca0f000
Remove dead code after not linting else if let
camsteffen May 17, 2021
8356c48
Fix manual_unwrap_or FP deref reference
camsteffen May 17, 2021
6fcdb8a
Auto merge of #7234 - camsteffen:if-let-else-braces, r=flip1995
bors May 17, 2021
be540e6
Remove powi, "square can be computed more efficiently"
mucinoab May 18, 2021
fd442c3
Add the command to add upstream remote
0xPoe May 18, 2021
9028173
Auto merge of #7201 - mucinoab:master, r=giraffate
bors May 18, 2021
716d03f
CI: update rustup before installing the toolchain on windows
flip1995 May 18, 2021
99fb776
Rollup merge of #7235 - camsteffen:manual-unwrap-or-deref, r=flip1995
flip1995 May 18, 2021
591145c
Rollup merge of #7237 - hi-rustin:rustin-patch-command, r=flip1995
flip1995 May 18, 2021
70c552b
Rollup merge of #7239 - flip1995:ci-windows-rustup, r=flip1995
flip1995 May 18, 2021
213b8d9
Auto merge of #7240 - flip1995:rollup-6nwjgyp, r=flip1995
bors May 18, 2021
ff452d5
Deny warning in every main sub-crate
flip1995 May 18, 2021
9586ddb
Fix fallout from not ignoring warnings anymore
flip1995 May 18, 2021
98cddc5
Auto merge of #7241 - flip1995:warn-deny-warnings, r=camsteffen
bors May 18, 2021
a149ba2
Fix ICE in `implicit_return`
Jarcho May 18, 2021
36be8ba
Auto merge of #7242 - Jarcho:implicit_return_ice, r=flip1995
bors May 18, 2021
760f703
Improve `multiple_inherent_impl` lint
Jarcho Apr 15, 2021
aa1959b
Auto merge of #7089 - Jarcho:multiple_impls_generic, r=Jarcho
bors May 18, 2021
4f3b49f
Auto merge of #84767 - scottmcm:try_trait_actual, r=lcnr
bors May 18, 2021
8036d7f
Adding the default lint level to the metadata collection
xFrednet May 19, 2021
9dc366b
Fixed a type
xFrednet May 19, 2021
2d597b7
Auto merge of #7246 - xFrednet:7172-add-lint-level-to-output, r=flip1995
bors May 19, 2021
451ff56
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 May 20, 2021
559ce6d
Bump nightly version -> 2021-05-20
flip1995 May 20, 2021
9e3cd88
Auto merge of #7252 - flip1995:rustup, r=flip1995
bors May 20, 2021
14f55fa
Merge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup
flip1995 May 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tools/clippy/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
uitest = "test --test compile-test"
dev = "run --target-dir clippy_dev/target --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
lintcheck = "run --target-dir lintcheck/target --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
collect-metadata = "test --test dogfood --features metadata-collector-lint -- run_metadata_collection_lint --ignored"

[build]
rustflags = ["-Zunstable-options"]
5 changes: 5 additions & 0 deletions src/tools/clippy/.github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ jobs:
- name: Checkout
uses: actions/[email protected]

# FIXME: should not be necessary once 1.24.2 is the default version on the windows runner
- name: Update rustup
run: rustup self update
if: runner.os == 'Windows'

- name: Install toolchain
run: rustup show active-toolchain

Expand Down
198 changes: 192 additions & 6 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,195 @@ document.

## Unreleased / In Rust Nightly

[6ed6f1e...master](https://github.com/rust-lang/rust-clippy/compare/6ed6f1e...master)
[7c7683c...master](https://github.com/rust-lang/rust-clippy/compare/7c7683c...master)

## Rust 1.53

Current beta, release 2021-06-17

[6ed6f1e...7c7683c](https://github.com/rust-lang/rust-clippy/compare/6ed6f1e...7c7683c)

### New Lints

* [`option_filter_map`]
[#6342](https://github.com/rust-lang/rust-clippy/pull/6342)
* [`branches_sharing_code`]
[#6463](https://github.com/rust-lang/rust-clippy/pull/6463)
* [`needless_for_each`]
[#6706](https://github.com/rust-lang/rust-clippy/pull/6706)
* [`if_then_some_else_none`]
[#6859](https://github.com/rust-lang/rust-clippy/pull/6859)
* [`non_octal_unix_permissions`]
[#7001](https://github.com/rust-lang/rust-clippy/pull/7001)
* [`unnecessary_self_imports`]
[#7072](https://github.com/rust-lang/rust-clippy/pull/7072)
* [`bool_assert_comparison`]
[#7083](https://github.com/rust-lang/rust-clippy/pull/7083)
* [`cloned_instead_of_copied`]
[#7098](https://github.com/rust-lang/rust-clippy/pull/7098)
* [`flat_map_option`]
[#7101](https://github.com/rust-lang/rust-clippy/pull/7101)

### Moves and Deprecations

* Deprecate [`filter_map`] lint
[#7059](https://github.com/rust-lang/rust-clippy/pull/7059)
* Move [`transmute_ptr_to_ptr`] to `pedantic`
[#7102](https://github.com/rust-lang/rust-clippy/pull/7102)

### Enhancements

* [`mem_replace_with_default`]: Also lint on common std constructors
[#6820](https://github.com/rust-lang/rust-clippy/pull/6820)
* [`wrong_self_convention`]: Also lint on `to_*_mut` methods
[#6828](https://github.com/rust-lang/rust-clippy/pull/6828)
* [`wildcard_enum_match_arm`], [`match_wildcard_for_single_variants`]:
[#6863](https://github.com/rust-lang/rust-clippy/pull/6863)
* Attempt to find a common path prefix in suggestion
* Don't lint on `Option` and `Result`
* Consider `Self` prefix
* [`explicit_deref_methods`]: Also lint on chained `deref` calls
[#6865](https://github.com/rust-lang/rust-clippy/pull/6865)
* [`or_fun_call`]: Also lint on `unsafe` blocks
[#6928](https://github.com/rust-lang/rust-clippy/pull/6928)
* [`vec_box`], [`linkedlist`], [`option_option`]: Also lint in `const` and
`static` items [#6938](https://github.com/rust-lang/rust-clippy/pull/6938)
* [`search_is_some`]: Also check for `is_none`
[#6942](https://github.com/rust-lang/rust-clippy/pull/6942)
* [`string_lit_as_bytes`]: Also lint on `into_bytes`
[#6959](https://github.com/rust-lang/rust-clippy/pull/6959)
* [`len_without_is_empty`]: Also lint if function signatures of `len` and
`is_empty` don't match
[#6980](https://github.com/rust-lang/rust-clippy/pull/6980)
* [`redundant_pattern_matching`]: Also lint if the pattern is a `&` pattern
[#6991](https://github.com/rust-lang/rust-clippy/pull/6991)
* [`clone_on_copy`]: Also lint on chained method calls taking `self` by value
[#7000](https://github.com/rust-lang/rust-clippy/pull/7000)
* [`missing_panics_doc`]: Also lint on `assert_eq!` and `assert_ne!`
[#7029](https://github.com/rust-lang/rust-clippy/pull/7029)
* [`needless_return`]: Also lint in `async` functions
[#7067](https://github.com/rust-lang/rust-clippy/pull/7067)
* [`unused_io_amount`]: Also lint on expressions like `_.read().ok()?`
[#7100](https://github.com/rust-lang/rust-clippy/pull/7100)
* [`iter_cloned_collect`]: Also lint on large arrays, since const-generics are
now stable [#7138](https://github.com/rust-lang/rust-clippy/pull/7138)

### False Positive Fixes

* [`upper_case_acronyms`]: No longer lints on public items
[#6805](https://github.com/rust-lang/rust-clippy/pull/6805)
* [`suspicious_map`]: No longer lints when side effects may occur inside the
`map` call [#6831](https://github.com/rust-lang/rust-clippy/pull/6831)
* [`manual_map`], [`manual_unwrap_or`]: No longer lints in `const` functions
[#6917](https://github.com/rust-lang/rust-clippy/pull/6917)
* [`wrong_self_convention`]: Now respects `Copy` types
[#6924](https://github.com/rust-lang/rust-clippy/pull/6924)
* [`needless_question_mark`]: No longer lints if the `?` and the `Some(..)` come
from different macro contexts [#6935](https://github.com/rust-lang/rust-clippy/pull/6935)
* [`map_entry`]: Better detect if the entry API can be used
[#6937](https://github.com/rust-lang/rust-clippy/pull/6937)
* [`or_fun_call`]: No longer lints on some `len` function calls
[#6950](https://github.com/rust-lang/rust-clippy/pull/6950)
* [`new_ret_no_self`]: No longer lints when `Self` is returned with different
generic arguments [#6952](https://github.com/rust-lang/rust-clippy/pull/6952)
* [`upper_case_acronyms`]: No longer lints on public items
[#6981](https://github.com/rust-lang/rust-clippy/pull/6981)
* [`explicit_into_iter_loop`]: Only lint when `into_iter` is an implementation
of `IntoIterator` [#6982](https://github.com/rust-lang/rust-clippy/pull/6982)
* [`expl_impl_clone_on_copy`]: Take generic constraints into account before
suggesting to use `derive` instead
[#6993](https://github.com/rust-lang/rust-clippy/pull/6993)
* [`missing_panics_doc`]: No longer lints when only debug-assertions are used
[#6996](https://github.com/rust-lang/rust-clippy/pull/6996)
* [`clone_on_copy`]: Only lint when using the `Clone` trait
[#7000](https://github.com/rust-lang/rust-clippy/pull/7000)
* [`wrong_self_convention`]: No longer lints inside a trait implementation
[#7002](https://github.com/rust-lang/rust-clippy/pull/7002)
* [`redundant_clone`]: No longer lints when the cloned value is modified while
the clone is in use
[#7011](https://github.com/rust-lang/rust-clippy/pull/7011)
* [`same_item_push`]: No longer lints if the `Vec` is used in the loop body
[#7018](https://github.com/rust-lang/rust-clippy/pull/7018)
* [`cargo_common_metadata`]: Remove author requirement
[#7026](https://github.com/rust-lang/rust-clippy/pull/7026)
* [`panic_in_result_fn`]: No longer lints on `debug_assert` family
[#7060](https://github.com/rust-lang/rust-clippy/pull/7060)
* [`panic`]: No longer wrongfully lints on `debug_assert` with message
[#7063](https://github.com/rust-lang/rust-clippy/pull/7063)
* [`wrong_self_convention`]: No longer lints in trait implementations where no
`self` is involved [#7064](https://github.com/rust-lang/rust-clippy/pull/7064)
* [`missing_const_for_fn`]: No longer lints when unstable `const` function is
involved [#7076](https://github.com/rust-lang/rust-clippy/pull/7076)
* [`suspicious_else_formatting`]: Allow Allman style braces
[#7087](https://github.com/rust-lang/rust-clippy/pull/7087)
* [`inconsistent_struct_constructor`]: No longer lints in macros
[#7097](https://github.com/rust-lang/rust-clippy/pull/7097)
* [`single_component_path_imports`]: No longer lints on macro re-exports
[#7120](https://github.com/rust-lang/rust-clippy/pull/7120)

### Suggestion Fixes/Improvements

* [`redundant_pattern_matching`]: Add a note when applying this lint would
change the drop order
[#6568](https://github.com/rust-lang/rust-clippy/pull/6568)
* [`write_literal`], [`print_literal`]: Add auto-applicable suggestion
[#6821](https://github.com/rust-lang/rust-clippy/pull/6821)
* [`manual_map`]: Fix suggestion for complex `if let ... else` chains
[#6856](https://github.com/rust-lang/rust-clippy/pull/6856)
* [`inconsistent_struct_constructor`]: Make lint description and message clearer
[#6892](https://github.com/rust-lang/rust-clippy/pull/6892)
* [`map_entry`]: Now suggests `or_insert`, `insert_with` or `match _.entry(_)`
as appropriate [#6937](https://github.com/rust-lang/rust-clippy/pull/6937)
* [`manual_flatten`]: Suggest to insert `copied` if necessary
[#6962](https://github.com/rust-lang/rust-clippy/pull/6962)
* [`redundant_slicing`]: Fix suggestion when a re-borrow might be required or
when the value is from a macro call
[#6975](https://github.com/rust-lang/rust-clippy/pull/6975)
* [`match_wildcard_for_single_variants`]: Fix suggestion for hidden variant
[#6988](https://github.com/rust-lang/rust-clippy/pull/6988)
* [`clone_on_copy`]: Correct suggestion when the cloned value is a macro call
[#7000](https://github.com/rust-lang/rust-clippy/pull/7000)
* [`manual_map`]: Fix suggestion at the end of an if chain
[#7004](https://github.com/rust-lang/rust-clippy/pull/7004)
* Fix needless parenthesis output in multiple lint suggestions
[#7013](https://github.com/rust-lang/rust-clippy/pull/7013)
* [`needless_collect`]: Better explanation in the lint message
[#7020](https://github.com/rust-lang/rust-clippy/pull/7020)
* [`useless_vec`]: Now considers mutability
[#7036](https://github.com/rust-lang/rust-clippy/pull/7036)
* [`useless_format`]: Wrap the content in braces if necessary
[#7092](https://github.com/rust-lang/rust-clippy/pull/7092)
* [`single_match`]: Don't suggest an equality check for types which don't
implement `PartialEq`
[#7093](https://github.com/rust-lang/rust-clippy/pull/7093)
* [`from_over_into`]: Mention type in help message
[#7099](https://github.com/rust-lang/rust-clippy/pull/7099)
* [`manual_unwrap_or`]: Fix invalid code suggestion due to a macro call
[#7136](https://github.com/rust-lang/rust-clippy/pull/7136)

### ICE Fixes

* [`macro_use_imports`]
[#7022](https://github.com/rust-lang/rust-clippy/pull/7022)
* [`missing_panics_doc`]
[#7034](https://github.com/rust-lang/rust-clippy/pull/7034)
* [`tabs_in_doc_comments`]
[#7039](https://github.com/rust-lang/rust-clippy/pull/7039)
* [`missing_const_for_fn`]
[#7128](https://github.com/rust-lang/rust-clippy/pull/7128)

### Others

* [Clippy's lint
list](https://rust-lang.github.io/rust-clippy/master/index.html) now supports
themes [#7030](https://github.com/rust-lang/rust-clippy/pull/7030)
* Lints that were uplifted to `rustc` now mention the new `rustc` name in the
deprecation warning
[#7056](https://github.com/rust-lang/rust-clippy/pull/7056)

## Rust 1.52

Current beta, release 2021-05-06
Current stable, released 2021-05-06

[3e41797...6ed6f1e](https://github.com/rust-lang/rust-clippy/compare/3e41797...6ed6f1e)

Expand Down Expand Up @@ -99,7 +283,7 @@ Current beta, release 2021-05-06
[#6682](https://github.com/rust-lang/rust-clippy/pull/6682)
* [`unit_arg`]: No longer lints on unit arguments when they come from a path expression.
[#6601](https://github.com/rust-lang/rust-clippy/pull/6601)
* [`cargo_common_metadata`]: No longer lints if
* [`cargo_common_metadata`]: No longer lints if
[`publish = false`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field)
is defined in the manifest
[#6650](https://github.com/rust-lang/rust-clippy/pull/6650)
Expand All @@ -124,11 +308,11 @@ Current beta, release 2021-05-06

* [`useless_format`]: Improved the documentation example
[#6854](https://github.com/rust-lang/rust-clippy/pull/6854)
* Clippy's [`README.md`]: Includes a new subsection on running Clippy as a rustc wrapper
* Clippy's [`README.md`]: Includes a new subsection on running Clippy as a rustc wrapper
[#6782](https://github.com/rust-lang/rust-clippy/pull/6782)

### Others
* Running `cargo clippy` after `cargo check` now works as expected
* Running `cargo clippy` after `cargo check` now works as expected
(`cargo clippy` and `cargo check` no longer shares the same build cache)
[#6687](https://github.com/rust-lang/rust-clippy/pull/6687)
* Cargo now re-runs Clippy if arguments after `--` provided to `cargo clippy` are changed.
Expand All @@ -145,7 +329,7 @@ Current beta, release 2021-05-06

## Rust 1.51

Current stable, released 2021-03-25
Released 2021-03-25

[4911ab1...3e41797](https://github.com/rust-lang/rust-clippy/compare/4911ab1...3e41797)

Expand Down Expand Up @@ -2365,6 +2549,7 @@ Released 2018-09-13
[`mutex_integer`]: https://rust-lang.github.io/rust-clippy/master/index.html#mutex_integer
[`naive_bytecount`]: https://rust-lang.github.io/rust-clippy/master/index.html#naive_bytecount
[`needless_arbitrary_self_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_arbitrary_self_type
[`needless_bitwise_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bitwise_bool
[`needless_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool
[`needless_borrow`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
[`needless_borrowed_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
Expand Down Expand Up @@ -2538,6 +2723,7 @@ Released 2018-09-13
[`unsound_collection_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#unsound_collection_transmute
[`unstable_as_mut_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_mut_slice
[`unstable_as_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_slice
[`unused_async`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
[`unused_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_collect
[`unused_io_amount`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ rustc-workspace-hack = "1.0.0"
rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }

[features]
deny-warnings = []
deny-warnings = ["clippy_lints/deny-warnings"]
integration = ["tempfile"]
internal-lints = ["clippy_lints/internal-lints"]
metadata-collector-lint = ["internal-lints", "clippy_lints/metadata-collector-lint"]
Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![feature(once_cell)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]

use itertools::Itertools;
use regex::Regex;
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]

use clap::{App, Arg, ArgMatches, SubCommand};
use clippy_dev::{bless, fmt, ide_setup, new_lint, serve, stderr_length_check, update_lints};
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustc-semver = "1.1.0"
url = { version = "2.1.0", features = ["serde"] }

[features]
deny-warnings = []
deny-warnings = ["clippy_utils/deny-warnings"]
# build clippy with internal lints enabled, off by default
internal-lints = ["clippy_utils/internal-lints"]
metadata-collector-lint = ["serde_json", "clippy_utils/metadata-collector-lint"]
Expand Down
11 changes: 9 additions & 2 deletions src/tools/clippy/clippy_lints/src/deprecated_lints.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/// This struct fakes the `Lint` declaration that is usually created by `declare_lint!`. This
/// enables the simple extraction of the metadata without changing the current deprecation
/// declaration.
pub struct ClippyDeprecatedLint;

macro_rules! declare_deprecated_lint {
(pub $name: ident, $_reason: expr) => {
declare_lint!(pub $name, Allow, "deprecated lint")
{ $(#[$attr:meta])* pub $name: ident, $_reason: expr} => {
$(#[$attr])*
#[allow(dead_code)]
pub static $name: ClippyDeprecatedLint = ClippyDeprecatedLint {};
}
}

Expand Down
16 changes: 6 additions & 10 deletions src/tools/clippy/clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::hir::map::Map;
use rustc_middle::ty::{self, Ty};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::{source_map::Span};
use rustc_span::source_map::Span;

declare_clippy_lint! {
/// **What it does:** Checks for deriving `Hash` but implementing `PartialEq`
Expand Down Expand Up @@ -310,15 +310,11 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &T
// there's a Copy impl for any instance of the adt.
if !is_copy(cx, ty) {
if ty_subs.non_erasable_generics().next().is_some() {
let has_copy_impl = cx
.tcx
.all_local_trait_impls(())
.get(&copy_id)
.map_or(false, |impls| {
impls
.iter()
.any(|&id| matches!(cx.tcx.type_of(id).kind(), ty::Adt(adt, _) if ty_adt.did == adt.did))
});
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| {
impls
.iter()
.any(|&id| matches!(cx.tcx.type_of(id).kind(), ty::Adt(adt, _) if ty_adt.did == adt.did))
});
if !has_copy_impl {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ pub fn strip_doc_comment_decoration(doc: &str, comment_kind: CommentKind, span:
let mut no_stars = String::with_capacity(doc.len());
for line in doc.lines() {
let mut chars = line.chars();
while let Some(c) = chars.next() {
for c in &mut chars {
if c.is_whitespace() {
no_stars.push(c);
} else {
Expand Down
12 changes: 1 addition & 11 deletions src/tools/clippy/clippy_lints/src/floating_point_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ fn check_powi(cx: &LateContext<'_>, expr: &Expr<'_>, args: &[Expr<'_>]) {
cx,
SUBOPTIMAL_FLOPS,
parent.span,
"square can be computed more efficiently",
"multiply and add expressions can be calculated more efficiently and accurately",
"consider using",
format!(
"{}.mul_add({}, {})",
Expand All @@ -337,16 +337,6 @@ fn check_powi(cx: &LateContext<'_>, expr: &Expr<'_>, args: &[Expr<'_>]) {
return;
}
}

span_lint_and_sugg(
cx,
SUBOPTIMAL_FLOPS,
expr.span,
"square can be computed more efficiently",
"consider using",
format!("{} * {}", Sugg::hir(cx, &args[0], ".."), Sugg::hir(cx, &args[0], "..")),
Applicability::MachineApplicable,
);
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/tools/clippy/clippy_lints/src/implicit_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ fn lint_implicit_returns(
visit_break_exprs(block, |break_expr, dest, sub_expr| {
if dest.target_id.ok() == Some(expr.hir_id) {
if call_site_span.is_none() && break_expr.span.ctxt() == ctxt {
lint_break(cx, break_expr.span, sub_expr.unwrap().span);
// At this point sub_expr can be `None` in async functions which either diverge, or return the
// unit type.
if let Some(sub_expr) = sub_expr {
lint_break(cx, break_expr.span, sub_expr.span);
}
} else {
// the break expression is from a macro call, add a return to the loop
add_return = true;
Expand Down
Loading