Skip to content
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

Clippy subtree update #120806

Merged
merged 89 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
b587871
Simplify `get_enclosing_loop_or_multi_call_closure`
Jarcho Nov 15, 2023
cdc4c69
Make `expr_use_ctxt` always return `Some` unless the syntax context c…
Jarcho Nov 15, 2023
57dd25e
FP: `needless_return_with_question_mark` with implicit Error Conversion
m-rph Dec 26, 2023
090c228
Fix/Issue11932: assert* in multi-condition after unrolling will cause…
cocodery Jan 3, 2024
b5a2192
fix: incorrect suggestions generated by `manual_retain` lint
yuxqiu Jan 3, 2024
03b3a16
test: add more test cases
yuxqiu Jan 4, 2024
bd6e920
modify check that any macros will be ingored in this lint, and add test
cocodery Jan 6, 2024
e0228ee
Fixes FP in `redundant_closure_call` when closures are passed to macros
m-rph Jan 3, 2024
3b8f62f
Add new `unnecessary_result_map_or_else` lint
GuillaumeGomez Jan 18, 2024
32bbeba
Add ui test for `unnecessary_result_map_or_else`
GuillaumeGomez Jan 18, 2024
e86da9e
Update CHANGELOG
GuillaumeGomez Jan 18, 2024
0b6cf3b
We don't look into static items anymore during const prop
oli-obk Jan 8, 2024
99d8d33
remove StructuralEq trait
RalfJung Sep 26, 2023
9cbc582
Rename the unescaping functions.
nnethercote Jan 24, 2024
e456c28
Don't warn about modulo arithmetic when comparing to zero
mdm Jan 19, 2024
58de630
Remove an unused error count check
oli-obk Jan 25, 2024
798865c
Merge commit '66c29b973b3b10278bd39f4e26b08522a379c2c9' into clippy-s…
flip1995 Jan 25, 2024
42d13f8
[`unconditional_recursion`]: compare by types instead of `DefId`s
y21 Jan 20, 2024
87a6300
add a test for rust-lang/rust-clippy#12181
y21 Jan 21, 2024
fd3e966
avoid linting on `#[track_caller]` functions in `redundant_closure`
y21 Jan 25, 2024
a65fe78
Auto merge of #116167 - RalfJung:structural-eq, r=lcnr
bors Jan 26, 2024
ed74c22
Auto merge of #12202 - y21:issue12199, r=Jarcho
bors Jan 26, 2024
9ce0b83
Clippy: Fix empty suggestion in from_over_into
flip1995 Jan 26, 2024
14e1520
Warn if an item coming from more recent version than MSRV is used
GuillaumeGomez Jan 17, 2024
8de9d8c
Auto merge of #12160 - GuillaumeGomez:incompatible-msrv, r=blyxyas
bors Jan 26, 2024
f096e91
Rollup merge of #120329 - nnethercote:3349-precursors, r=fee1-dead
matthiaskrgr Jan 26, 2024
57f63a3
Rollup merge of #120345 - flip1995:clippy-subtree-update, r=Manishearth
matthiaskrgr Jan 26, 2024
1d94cc3
remove illegal_floating_point_literal_pattern lint
RalfJung Jan 6, 2024
f58950d
correct lint case
m-rph Jan 26, 2024
6d76d14
add to_string_trait_impl lint
andrewbanchich Jan 10, 2024
8905f78
Auto merge of #12082 - PartiallyTyped:1553, r=dswij
bors Jan 27, 2024
855aa08
Auto merge of #12178 - mdm:modulo-arithmetic-comparison-to-zero, r=ll…
bors Jan 27, 2024
79f10cf
Auto merge of #12122 - andrewbanchich:tostring-impl, r=llogiq
bors Jan 27, 2024
85e08cd
Auto merge of #12169 - GuillaumeGomez:unnecessary_result_map_or_else,…
bors Jan 27, 2024
a51fc2a
Fix `NonZero` clippy lints.
reitermarkus May 12, 2023
ff5afac
[`never_loop`]: recognize `?` desugaring in try blocks
y21 Jan 27, 2024
18e1f25
Auto merge of #12206 - y21:issue12205, r=Alexendoo
bors Jan 27, 2024
276ce39
Auto merge of #12083 - cocodery:fix/issue11932, r=Alexendoo
bors Jan 27, 2024
8ccf6a6
Auto merge of #12084 - yuxqiu:manual_retain, r=Alexendoo
bors Jan 27, 2024
3aa2c27
rewrote to match only Result::err cons
m-rph Jan 28, 2024
e7a3cb7
Auto merge of #12021 - PartiallyTyped:11982, r=flip1995
bors Jan 29, 2024
b3d5377
Make `redundant_closure_for_method_calls` suggest relative paths
modelflat Aug 21, 2023
b2f2080
Add regression test for #2371
GuillaumeGomez Jan 29, 2024
ce8b4b6
Remove fixed FIXME
GuillaumeGomez Jan 29, 2024
3cd713a
Auto merge of #11370 - modelflat:suggest-relpath-in-redundant-closure…
bors Jan 29, 2024
73706e8
Makes clippy-driver check for --sysroot in arg files
Jan 26, 2024
1156375
Auto merge of #12203 - daivinhtran:fix-clippy-driver-to-accept-param-…
bors Jan 29, 2024
455c07b
Auto merge of #12210 - GuillaumeGomez:add-regression-test-2371, r=bly…
bors Jan 29, 2024
d02df12
add configuration for [`wildcard_imports`] to ignore certain imports
J-ZhengLi Dec 18, 2023
314bdde
add more test cases & improve docs & replace `Vec` with `FxHashSet` f…
J-ZhengLi Jan 29, 2024
c0f49a9
hir: Simplify `hir_owner_nodes` query
petrochenkov Jan 25, 2024
7539054
hir: Add non-optional `hir_owner_nodes` for real `OwnerId`s
petrochenkov Jan 25, 2024
233c8c9
hir: Remove `hir::Map::{owner,expect_owner}`
petrochenkov Jan 25, 2024
f0dbf68
Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercote
GuillaumeGomez Jan 30, 2024
3106219
Don't lint slice type annotations for byte strings
bpandreotti Jan 30, 2024
ae0f0fd
Don't hash lints differently to non-lints.
nnethercote Jan 30, 2024
9e3bb89
Auto merge of #120346 - petrochenkov:ownodes, r=oli-obk
bors Jan 31, 2024
7836678
Rollup merge of #120490 - nnethercote:Diagnostic-hashing, r=estebank
Nadrieril Jan 31, 2024
6619e8c
Add `lint_groups_priority` lint
Alexendoo Jan 31, 2024
b58b88c
Auto merge of #11832 - Alexendoo:lint-groups-priority, r=flip1995
bors Jan 31, 2024
fe8c2e2
Fixed FP in `unused_io_amount` for `Ok(lit)`, `unrachable!`
m-rph Jan 30, 2024
46dd826
rename conf option to `allowed_wildcard_imports`
J-ZhengLi Feb 2, 2024
9b6f866
Auto merge of #12217 - PartiallyTyped:12208, r=blyxyas
bors Feb 2, 2024
c82162e
Auto merge of #11979 - J-ZhengLi:issue11428, r=Alexendoo
bors Feb 2, 2024
abced20
Avoid deleting labeled blocks
sanxiyn Jan 31, 2024
9fb4107
Auto merge of #12219 - sanxiyn:labeled-block, r=blyxyas
bors Feb 3, 2024
be47e32
Update version attributes for 1.76 lints
xFrednet Feb 4, 2024
aa1de4d
Changelog for Clippy 1.76 :cat2:
xFrednet Feb 4, 2024
a3baebc
Add ref_as_ptr lint
marcin-serwin Jan 2, 2024
34e4c9f
Auto merge of #12087 - marcin-serwin:ref_as_ptr_cast, r=blyxyas
bors Feb 4, 2024
7c3908f
[`redundant_locals`]: take by-value closure captures into account
y21 Feb 4, 2024
8baeb26
Auto merge of #12224 - xFrednet:chaneglog-1-76, r=Manishearth
bors Feb 5, 2024
d13ce19
Rollup merge of #116284 - RalfJung:no-nan-match, r=cjgillot
matthiaskrgr Feb 5, 2024
6807977
also check for coroutines
y21 Feb 5, 2024
7f80b44
new lint: `manual_c_str_literals`
y21 Dec 3, 2023
005b6c2
Auto merge of #11919 - y21:manual_c_str_literals, r=xFrednet
bors Feb 5, 2024
fdf819d
Auto merge of #12227 - y21:issue12225, r=Manishearth
bors Feb 5, 2024
7895b98
Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs
compiler-errors Jan 24, 2024
36f7248
Fix release year in CHANGELOG.md
nyurik Feb 6, 2024
d910f77
Auto merge of #12235 - nyurik:patch-1, r=flip1995
bors Feb 6, 2024
b1e5a58
Auto merge of #11812 - Jarcho:issue_11786, r=Alexendoo
bors Feb 6, 2024
08c8cd5
Auto merge of #12216 - bpandreotti:redundant-type-annotations-fix, r=…
bors Feb 7, 2024
62dcbd6
Auto merge of #12177 - y21:issue12154, r=Jarcho
bors Feb 7, 2024
d2f76f7
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Feb 8, 2024
031c46d
Bump nightly version -> 2024-02-08
flip1995 Feb 8, 2024
2ca6c84
Bump Clippy version -> 0.1.78
flip1995 Feb 8, 2024
60cb29c
Auto merge of #12246 - flip1995:rustup, r=flip1995
bors Feb 8, 2024
beb4f7d
Merge commit '60cb29c5e4f9772685c9873752196725c946a849' into clippyup
flip1995 Feb 8, 2024
4ec9eec
Update Cargo.lock
flip1995 Feb 8, 2024
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
10 changes: 5 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"

[[package]]
name = "clippy"
version = "0.1.77"
version = "0.1.78"
dependencies = [
"anstream",
"clippy_config",
Expand Down Expand Up @@ -584,7 +584,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.77"
version = "0.1.78"
dependencies = [
"rustc-semver",
"serde",
Expand All @@ -607,7 +607,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.77"
version = "0.1.78"
dependencies = [
"arrayvec",
"cargo_metadata 0.18.0",
Expand All @@ -632,7 +632,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.77"
version = "0.1.78"
dependencies = [
"arrayvec",
"clippy_config",
Expand Down Expand Up @@ -1003,7 +1003,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"

[[package]]
name = "declare_clippy_lint"
version = "0.1.77"
version = "0.1.78"
dependencies = [
"itertools",
"quote",
Expand Down
15 changes: 15 additions & 0 deletions src/tools/clippy/.github/driver.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ if [[ ${OS} == "Windows" ]]; then
else
desired_sysroot=/tmp
fi
# Set --sysroot in command line
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
test "$sysroot" = $desired_sysroot

# Set --sysroot in arg_file.txt and pass @arg_file.txt to command line
echo "--sysroot=$desired_sysroot" > arg_file.txt
sysroot=$(./target/debug/clippy-driver @arg_file.txt --print sysroot)
test "$sysroot" = $desired_sysroot

# Setting SYSROOT in command line
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
test "$sysroot" = $desired_sysroot

Expand All @@ -24,6 +31,14 @@ test "$sysroot" = $desired_sysroot
SYSROOT=/tmp RUSTFLAGS="--sysroot=$(rustc --print sysroot)" ../target/debug/cargo-clippy clippy --verbose
)

# Check that the --sysroot argument is only passed once via arg_file.txt (SYSROOT is ignored)
(
echo "fn main() {}" > target/driver_test.rs
echo "--sysroot="$(./target/debug/clippy-driver --print sysroot)"" > arg_file.txt
echo "--verbose" >> arg_file.txt
SYSROOT=/tmp ./target/debug/clippy-driver @arg_file.txt ./target/driver_test.rs
)

# Make sure this isn't set - clippy-driver should cope without it
unset CARGO_MANIFEST_DIR

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

## Unreleased / Beta / In Rust Nightly

[09ac14c9...master](https://github.com/rust-lang/rust-clippy/compare/09ac14c9...master)
[a859e5cc...master](https://github.com/rust-lang/rust-clippy/compare/a859e5cc...master)

## Rust 1.76

Current stable, released 2024-02-08

[View all 85 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-11-02T20%3A23%3A40Z..2023-12-16T13%3A11%3A08Z+base%3Amaster)

### New Lints

- [`infinite_loop`]
[#11829](https://github.com/rust-lang/rust-clippy/pull/11829)
- [`ineffective_open_options`]
[#11902](https://github.com/rust-lang/rust-clippy/pull/11902)
- [`uninhabited_references`]
[#11878](https://github.com/rust-lang/rust-clippy/pull/11878)
- [`repeat_vec_with_capacity`]
[#11597](https://github.com/rust-lang/rust-clippy/pull/11597)
- [`test_attr_in_doctest`]
[#11872](https://github.com/rust-lang/rust-clippy/pull/11872)
- [`option_map_or_err_ok`]
[#11864](https://github.com/rust-lang/rust-clippy/pull/11864)
- [`join_absolute_paths`]
[#11453](https://github.com/rust-lang/rust-clippy/pull/11453)
- [`impl_hash_borrow_with_str_and_bytes`]
[#11781](https://github.com/rust-lang/rust-clippy/pull/11781)
- [`iter_over_hash_type`]
[#11791](https://github.com/rust-lang/rust-clippy/pull/11791)

### Moves and Deprecations

- Renamed `blocks_in_if_conditions` to [`blocks_in_conditions`]
[#11853](https://github.com/rust-lang/rust-clippy/pull/11853)
- Moved [`implied_bounds_in_impls`] to `complexity` (Now warn-by-default)
[#11867](https://github.com/rust-lang/rust-clippy/pull/11867)
- Moved [`if_same_then_else`] to `style` (Now warn-by-default)
[#11809](https://github.com/rust-lang/rust-clippy/pull/11809)

### Enhancements

- [`missing_safety_doc`], [`unnecessary_safety_doc`], [`missing_panics_doc`], [`missing_errors_doc`]:
Added the [`check-private-items`] configuration to enable lints on private items
[#11842](https://github.com/rust-lang/rust-clippy/pull/11842)

### ICE Fixes

- [`impl_trait_in_params`]: No longer crashes when a function has generics but no function parameters
[#11804](https://github.com/rust-lang/rust-clippy/pull/11804)
- [`unused_enumerate_index`]: No longer crashes on empty tuples
[#11756](https://github.com/rust-lang/rust-clippy/pull/11756)

### Others

- Clippy now respects the `CARGO` environment value
[#11944](https://github.com/rust-lang/rust-clippy/pull/11944)

## Rust 1.75

Current stable, released 2023-12-28
Released 2023-12-28

[View all 69 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-09-25T11%3A47%3A47Z..2023-11-02T16%3A41%3A59Z+base%3Amaster)

Expand Down Expand Up @@ -5198,6 +5252,7 @@ Released 2018-09-13
[`implied_bounds_in_impls`]: https://rust-lang.github.io/rust-clippy/master/index.html#implied_bounds_in_impls
[`impossible_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#impossible_comparisons
[`imprecise_flops`]: https://rust-lang.github.io/rust-clippy/master/index.html#imprecise_flops
[`incompatible_msrv`]: https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
[`inconsistent_digit_grouping`]: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping
[`inconsistent_struct_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor
[`incorrect_clone_impl_on_copy_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_clone_impl_on_copy_type
Expand Down Expand Up @@ -5276,6 +5331,7 @@ Released 2018-09-13
[`let_with_type_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#let_with_type_underscore
[`lines_filter_map_ok`]: https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok
[`linkedlist`]: https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist
[`lint_groups_priority`]: https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority
[`little_endian_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#little_endian_bytes
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
Expand All @@ -5284,6 +5340,7 @@ Released 2018-09-13
[`manual_assert`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
[`manual_async_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
[`manual_bits`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits
[`manual_c_str_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals
[`manual_clamp`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_clamp
[`manual_filter`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter
[`manual_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter_map
Expand Down Expand Up @@ -5523,6 +5580,7 @@ Released 2018-09-13
[`redundant_slicing`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
[`redundant_type_annotations`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_type_annotations
[`ref_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr
[`ref_binding_to_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_binding_to_reference
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
[`ref_option_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
Expand Down Expand Up @@ -5622,6 +5680,7 @@ Released 2018-09-13
[`to_digit_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_digit_is_some
[`to_string_in_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_display
[`to_string_in_format_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
[`to_string_trait_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
[`todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
[`too_many_lines`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
Expand Down Expand Up @@ -5677,6 +5736,7 @@ Released 2018-09-13
[`unnecessary_mut_passed`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation
[`unnecessary_owned_empty_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_owned_empty_strings
[`unnecessary_result_map_or_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_result_map_or_else
[`unnecessary_safety_comment`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_safety_comment
[`unnecessary_safety_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_safety_doc
[`unnecessary_self_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_self_imports
Expand Down Expand Up @@ -5819,4 +5879,6 @@ Released 2018-09-13
[`enforce-iter-loop-reborrow`]: https://doc.rust-lang.org/clippy/lint_configuration.html#enforce-iter-loop-reborrow
[`check-private-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items
[`pub-underscore-fields-behavior`]: https://doc.rust-lang.org/clippy/lint_configuration.html#pub-underscore-fields-behavior
[`allow-comparison-to-zero`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-comparison-to-zero
[`allowed-wildcard-imports`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-wildcard-imports
<!-- end autogenerated links to configuration documentation -->
2 changes: 1 addition & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.77"
version = "0.1.78"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
33 changes: 33 additions & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
* [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold)
* [`manual_hash_one`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one)
* [`iter_kv_map`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map)
* [`manual_c_str_literals`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_c_str_literals)


## `cognitive-complexity-threshold`
Expand Down Expand Up @@ -828,3 +829,35 @@ exported visibility, or whether they are marked as "pub".
* [`pub_underscore_fields`](https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields)


## `allow-comparison-to-zero`
Don't lint when comparing the result of a modulo operation to zero.

**Default Value:** `true`

---
**Affected lints:**
* [`modulo_arithmetic`](https://rust-lang.github.io/rust-clippy/master/index.html#modulo_arithmetic)


## `allowed-wildcard-imports`
List of path segments allowed to have wildcard imports.

#### Example

```toml
allowed-wildcard-imports = [ "utils", "common" ]
```

#### Noteworthy

1. This configuration has no effects if used with `warn_on_all_wildcard_imports = true`.
2. Paths with any segment that containing the word 'prelude'
are already allowed by default.

**Default Value:** `[]`

---
**Affected lints:**
* [`wildcard_imports`](https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports)


2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_config"
version = "0.1.77"
version = "0.1.78"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
22 changes: 21 additions & 1 deletion src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ define_Conf! {
///
/// Suppress lints whenever the suggested change would cause breakage for other crates.
(avoid_breaking_exported_api: bool = true),
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP.
/// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, OPTION_MAP_UNWRAP_OR, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT, DEPRECATED_CFG_ATTR, INDEX_REFUTABLE_SLICE, MAP_CLONE, BORROW_AS_PTR, MANUAL_BITS, ERR_EXPECT, CAST_ABS_TO_UNSIGNED, UNINLINED_FORMAT_ARGS, MANUAL_CLAMP, MANUAL_LET_ELSE, UNCHECKED_DURATION_SUBTRACTION, COLLAPSIBLE_STR_REPLACE, SEEK_FROM_CURRENT, SEEK_REWIND, UNNECESSARY_LAZY_EVALUATIONS, TRANSMUTE_PTR_TO_REF, ALMOST_COMPLETE_RANGE, NEEDLESS_BORROW, DERIVABLE_IMPLS, MANUAL_IS_ASCII_CHECK, MANUAL_REM_EUCLID, MANUAL_RETAIN, TYPE_REPETITION_IN_BOUNDS, TUPLE_ARRAY_CONVERSIONS, MANUAL_TRY_FOLD, MANUAL_HASH_ONE, ITER_KV_MAP, MANUAL_C_STR_LITERALS.
///
/// The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
#[default_text = ""]
Expand Down Expand Up @@ -567,6 +567,26 @@ define_Conf! {
/// Lint "public" fields in a struct that are prefixed with an underscore based on their
/// exported visibility, or whether they are marked as "pub".
(pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour = PubUnderscoreFieldsBehaviour::PubliclyExported),
/// Lint: MODULO_ARITHMETIC.
///
/// Don't lint when comparing the result of a modulo operation to zero.
(allow_comparison_to_zero: bool = true),
/// Lint: WILDCARD_IMPORTS.
///
/// List of path segments allowed to have wildcard imports.
///
/// #### Example
///
/// ```toml
/// allowed-wildcard-imports = [ "utils", "common" ]
/// ```
///
/// #### Noteworthy
///
/// 1. This configuration has no effects if used with `warn_on_all_wildcard_imports = true`.
/// 2. Paths with any segment that containing the word 'prelude'
/// are already allowed by default.
(allowed_wildcard_imports: FxHashSet<String> = FxHashSet::default()),
}

/// Search for the configuration file.
Expand Down
13 changes: 13 additions & 0 deletions src/tools/clippy/clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use rustc_semver::RustcVersion;
use rustc_session::Session;
use rustc_span::{sym, Symbol};
use serde::Deserialize;
use std::fmt;

macro_rules! msrv_aliases {
($($major:literal,$minor:literal,$patch:literal {
Expand All @@ -16,6 +17,8 @@ macro_rules! msrv_aliases {

// names may refer to stabilized feature flags or library items
msrv_aliases! {
1,77,0 { C_STR_LITERALS }
1,76,0 { PTR_FROM_REF }
1,71,0 { TUPLE_ARRAY_CONVERSIONS, BUILD_HASHER_HASH_ONE }
1,70,0 { OPTION_RESULT_IS_VARIANT_AND, BINARY_HEAP_RETAIN }
1,68,0 { PATH_MAIN_SEPARATOR_STR }
Expand Down Expand Up @@ -58,6 +61,16 @@ pub struct Msrv {
stack: Vec<RustcVersion>,
}

impl fmt::Display for Msrv {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(msrv) = self.current() {
write!(f, "{msrv}")
} else {
f.write_str("1.0.0")
}
}
}

impl<'de> Deserialize<'de> for Msrv {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
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
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.77"
version = "0.1.78"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ struct NotSimplificationVisitor<'a, 'tcx> {
impl<'a, 'tcx> Visitor<'tcx> for NotSimplificationVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
if let ExprKind::Unary(UnOp::Not, inner) = &expr.kind
&& !expr.span.from_expansion()
&& !inner.span.from_expansion()
&& let Some(suggestion) = simplify_not(self.cx, inner)
&& self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, expr.hir_id).0 != Level::Allow
Expand Down
Loading
Loading