Skip to content

Commit 61c8c49

Browse files
committed
Merge from rust-lang/rust
2 parents b5c9022 + 73bac59 commit 61c8c49

File tree

433 files changed

+8703
-3653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

433 files changed

+8703
-3653
lines changed

.github/driver.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
set -ex
44

5+
sysroot="$(rustc --print sysroot)"
6+
case $OS in
7+
Linux) export LD_LIBRARY_PATH="$sysroot/lib" ;;
8+
macOS) export DYLD_FALLBACK_LIBRARY_PATH="$sysroot/lib" ;;
9+
Windows) export PATH="$(cygpath "$sysroot")/bin:$PATH" ;;
10+
*) exit 1
11+
esac
12+
513
# Check sysroot handling
6-
sysroot=$(./target/debug/clippy-driver --print sysroot)
7-
test "$sysroot" = "$(rustc --print sysroot)"
8-
9-
if [[ ${OS} == "Windows" ]]; then
10-
desired_sysroot=C:/tmp
11-
else
12-
desired_sysroot=/tmp
13-
fi
14+
test "$(./target/debug/clippy-driver --print sysroot)" = "$sysroot"
15+
16+
desired_sysroot="target/sysroot"
1417
# Set --sysroot in command line
1518
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
1619
test "$sysroot" = $desired_sysroot

.github/workflows/clippy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ jobs:
6969
working-directory: clippy_dev
7070

7171
- name: Test clippy-driver
72-
run: |
73-
TOOLCHAIN=$(rustup show active-toolchain | cut -f1 -d' ')
74-
rustup run $TOOLCHAIN bash .github/driver.sh
72+
run: .github/driver.sh
73+
env:
74+
OS: ${{ runner.os }}

.github/workflows/clippy_bors.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ jobs:
116116
working-directory: clippy_dev
117117

118118
- name: Test clippy-driver
119-
run: |
120-
TOOLCHAIN=$(rustup show active-toolchain | cut -f1 -d' ')
121-
rustup run $TOOLCHAIN bash .github/driver.sh
119+
run: .github/driver.sh
122120
env:
123121
OS: ${{ runner.os }}
124122

CHANGELOG.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,69 @@ document.
66

77
## Unreleased / Beta / In Rust Nightly
88

9-
[93f0a9a9...master](https://github.com/rust-lang/rust-clippy/compare/93f0a9a9...master)
9+
[ca3b3937...master](https://github.com/rust-lang/rust-clippy/compare/ca3b3937...master)
10+
11+
## Rust 1.79
12+
13+
Current stable, released 2024-06-13
14+
15+
[View all 102 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-03-08T11%3A13%3A58Z..2024-04-18T15%3A50%3A50Z+base%3Amaster)
16+
17+
### New Lints
18+
19+
* Added [`legacy_numeric_constants`] to `style`
20+
[#12312](https://github.com/rust-lang/rust-clippy/pull/12312)
21+
* Added [`missing_transmute_annotations`] to `suspicious`
22+
[#12239](https://github.com/rust-lang/rust-clippy/pull/12239)
23+
* Added [`integer_division_remainder_used`] to `restriction`
24+
[#12451](https://github.com/rust-lang/rust-clippy/pull/12451)
25+
* Added [`duplicated_attributes`] to `suspicious`
26+
[#12378](https://github.com/rust-lang/rust-clippy/pull/12378)
27+
* Added [`manual_unwrap_or_default`] to `suspicious`
28+
[#12440](https://github.com/rust-lang/rust-clippy/pull/12440)
29+
* Added [`zero_repeat_side_effects`] to `suspicious`
30+
[#12449](https://github.com/rust-lang/rust-clippy/pull/12449)
31+
* Added [`const_is_empty`] to `suspicious`
32+
[#12310](https://github.com/rust-lang/rust-clippy/pull/12310)
33+
34+
### Moves and Deprecations
35+
36+
* Moved [`box_default`] to `style` (From `perf`)
37+
[#12601](https://github.com/rust-lang/rust-clippy/pull/12601)
38+
* Moved [`manual_clamp`] to `complexity` (From `nursery` now warn-by-default)
39+
[#12543](https://github.com/rust-lang/rust-clippy/pull/12543)
40+
* Moved [`readonly_write_lock`] to `perf` (From `nursery` now warn-by-default)
41+
[#12479](https://github.com/rust-lang/rust-clippy/pull/12479)
42+
43+
### Enhancements
44+
45+
* [`module_name_repetitions`]: Added the [`allowed-prefixes`] configuration to allow common prefixes.
46+
[#12573](https://github.com/rust-lang/rust-clippy/pull/12573)
47+
* [`cast_sign_loss`], [`cast_possible_truncation`], [`cast_lossless`]: Are now allowed in macros
48+
[#12631](https://github.com/rust-lang/rust-clippy/pull/12631)
49+
* [`manual_clamp`]: Now only lints on constant min and max values
50+
[#12543](https://github.com/rust-lang/rust-clippy/pull/12543)
51+
* [`assigning_clones`]: Now considers the [`msrv`] configuration
52+
[#12511](https://github.com/rust-lang/rust-clippy/pull/12511)
53+
* [`needless_return`], [`useless_let_if_seq`], [`mut_mut`], [`read_zero_byte_vec`], [`unused_io_amount`],
54+
[`unused_peekable`]: Now respects `#[allow]` attributes on the affected statement instead
55+
[#12446](https://github.com/rust-lang/rust-clippy/pull/12446)
56+
57+
### False Positive Fixes
58+
59+
* [`cast_lossless`]: No longer lints when casting to `u128`
60+
[#12496](https://github.com/rust-lang/rust-clippy/pull/12496)
61+
* [`std_instead_of_core`] No longer lints on modules that are only in `std`
62+
[#12447](https://github.com/rust-lang/rust-clippy/pull/12447)
63+
64+
### ICE Fixes
65+
66+
* [`needless_return`]: No longer crashes on non-ascii characters
67+
[#12493](https://github.com/rust-lang/rust-clippy/pull/12493)
1068

1169
## Rust 1.78
1270

13-
Current stable, released 2024-05-02
71+
Released 2024-05-02
1472

1573
[View all 112 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-01-26T05%3A46%3A23Z..2024-03-07T16%3A25%3A52Z+base%3Amaster)
1674

@@ -5249,6 +5307,7 @@ Released 2018-09-13
52495307
[`disallowed_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_type
52505308
[`disallowed_types`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
52515309
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
5310+
[`doc_lazy_continuation`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
52525311
[`doc_link_with_quotes`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
52535312
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
52545313
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
@@ -5447,6 +5506,7 @@ Released 2018-09-13
54475506
[`little_endian_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#little_endian_bytes
54485507
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
54495508
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
5509+
[`macro_metavars_in_unsafe`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_metavars_in_unsafe
54505510
[`macro_use_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_imports
54515511
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
54525512
[`manual_assert`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
@@ -5472,6 +5532,7 @@ Released 2018-09-13
54725532
[`manual_next_back`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_next_back
54735533
[`manual_non_exhaustive`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
54745534
[`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or
5535+
[`manual_pattern_char_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison
54755536
[`manual_range_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
54765537
[`manual_range_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns
54775538
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid
@@ -5565,6 +5626,7 @@ Released 2018-09-13
55655626
[`needless_borrow`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
55665627
[`needless_borrowed_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
55675628
[`needless_borrows_for_generic_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
5629+
[`needless_character_iteration`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_character_iteration
55685630
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
55695631
[`needless_continue`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_continue
55705632
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
@@ -5574,6 +5636,7 @@ Released 2018-09-13
55745636
[`needless_late_init`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
55755637
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
55765638
[`needless_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_match
5639+
[`needless_maybe_sized`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_maybe_sized
55775640
[`needless_option_as_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_as_deref
55785641
[`needless_option_take`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_option_take
55795642
[`needless_parens_on_range_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_parens_on_range_literals
@@ -5702,6 +5765,7 @@ Released 2018-09-13
57025765
[`ref_option_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
57035766
[`ref_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_patterns
57045767
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
5768+
[`renamed_function_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#renamed_function_params
57055769
[`repeat_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_once
57065770
[`repeat_vec_with_capacity`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_vec_with_capacity
57075771
[`replace_consts`]: https://rust-lang.github.io/rust-clippy/master/index.html#replace_consts
@@ -5908,6 +5972,7 @@ Released 2018-09-13
59085972
[`verbose_file_reads`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_file_reads
59095973
[`vtable_address_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#vtable_address_comparisons
59105974
[`waker_clone_wake`]: https://rust-lang.github.io/rust-clippy/master/index.html#waker_clone_wake
5975+
[`while_float`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_float
59115976
[`while_immutable_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_immutable_condition
59125977
[`while_let_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop
59135978
[`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
@@ -5939,8 +6004,10 @@ Released 2018-09-13
59396004
[`allow-expect-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-expect-in-tests
59406005
[`allow-mixed-uninlined-format-args`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-mixed-uninlined-format-args
59416006
[`allow-one-hash-in-raw-strings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-one-hash-in-raw-strings
6007+
[`allow-panic-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-panic-in-tests
59426008
[`allow-print-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-print-in-tests
59436009
[`allow-private-module-inception`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-private-module-inception
6010+
[`allow-renamed-params-for`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-renamed-params-for
59446011
[`allow-unwrap-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-unwrap-in-tests
59456012
[`allow-useless-vec-in-tests`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allow-useless-vec-in-tests
59466013
[`allowed-dotfiles`]: https://doc.rust-lang.org/clippy/lint_configuration.html#allowed-dotfiles
@@ -6002,4 +6069,5 @@ Released 2018-09-13
60026069
[`vec-box-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#vec-box-size-threshold
60036070
[`verbose-bit-mask-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#verbose-bit-mask-threshold
60046071
[`warn-on-all-wildcard-imports`]: https://doc.rust-lang.org/clippy/lint_configuration.html#warn-on-all-wildcard-imports
6072+
[`warn-unsafe-macro-metavars-in-private-macros`]: https://doc.rust-lang.org/clippy/lint_configuration.html#warn-unsafe-macro-metavars-in-private-macros
60056073
<!-- end autogenerated links to configuration documentation -->

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.80"
3+
version = "0.1.81"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints:
172172

173173
Note: `allow` means to suppress the lint for your code. With `warn` the lint
174174
will only emit a warning, while with `deny` the lint will emit an error, when
175-
triggering for your code. An error causes clippy to exit with an error code, so
175+
triggering for your code. An error causes Clippy to exit with an error code, so
176176
is useful in scripts like CI/CD.
177177

178178
If you do not want to include your lint levels in your code, you can globally
@@ -238,7 +238,7 @@ define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
238238
### Specifying the minimum supported Rust version
239239

240240
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by
241-
specifying the minimum supported Rust version (MSRV) in the clippy configuration file.
241+
specifying the minimum supported Rust version (MSRV) in the Clippy configuration file.
242242

243243
```toml
244244
msrv = "1.30.0"

book/src/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ For more details and options, refer to the Cargo documentation.
9999
### Specifying the minimum supported Rust version
100100

101101
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by specifying the
102-
minimum supported Rust version (MSRV) in the clippy configuration file.
102+
minimum supported Rust version (MSRV) in the Clippy configuration file.
103103

104104
```toml
105105
msrv = "1.30.0"
@@ -133,7 +133,7 @@ Very rarely, you may wish to prevent Clippy from evaluating certain sections of
133133
`clippy` cfg is not set. You may need to provide a stub so that the code compiles:
134134

135135
```rust
136-
#[cfg(not(clippy)]
136+
#[cfg(not(clippy))]
137137
include!(concat!(env!("OUT_DIR"), "/my_big_function-generated.rs"));
138138

139139
#[cfg(clippy)]

book/src/development/adding_lints.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,11 @@ declare_clippy_lint! {
587587
}
588588
```
589589

590+
If the lint is in the `restriction` group because it lints things that are not
591+
necessarily “bad” but are more of a style choice, then replace the
592+
“Why is this bad?” section heading with “Why restrict this?”, to avoid writing
593+
“Why is this bad? It isn't, but ...”.
594+
590595
Once your lint is merged, this documentation will show up in the [lint
591596
list][lint_list].
592597

book/src/development/basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ More about [intellij] command usage and reasons.
107107

108108
## lintcheck
109109

110-
`cargo lintcheck` will build and run clippy on a fixed set of crates and
110+
`cargo lintcheck` will build and run Clippy on a fixed set of crates and
111111
generate a log of the results. You can `git diff` the updated log against its
112112
previous version and see what impact your lint made on a small set of crates.
113113
If you add a new lint, please audit the resulting warnings and make sure there

book/src/development/defining_lints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ declare_clippy_lint! {
163163
///
164164
/// ### Example
165165
/// ```rust
166-
/// // example code where clippy issues a warning
166+
/// // example code where Clippy issues a warning
167167
/// ```
168168
/// Use instead:
169169
/// ```rust
170-
/// // example code which does not raise clippy warning
170+
/// // example code which does not raise Clippy warning
171171
/// ```
172172
#[clippy::version = "1.70.0"] // <- In which version was this implemented, keep it up to date!
173173
pub LINT_NAME, // <- The lint name IN_ALL_CAPS

0 commit comments

Comments
 (0)