Skip to content

Commit 2522a03

Browse files
committed
Run CI checks for Rust 2024 as well
4 parents 540e116 + 0c1ef98 + 8052451 + 2298a67 commit 2522a03

File tree

72 files changed

+1176
-162
lines changed

Some content is hidden

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

72 files changed

+1176
-162
lines changed

.github/workflows/clippy.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,52 @@ jobs:
7373
run: .github/driver.sh
7474
env:
7575
OS: ${{ runner.os }}
76+
77+
base-2024:
78+
# NOTE: If you modify this job, make sure you copy the changes to clippy_bors.yml
79+
runs-on: ubuntu-latest
80+
81+
steps:
82+
# Setup
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
86+
- name: Select Rust 2024 edition
87+
run: |
88+
for i in clippy_config clippy_dev clippy_lints clippy_utils lintcheck; do
89+
sed -i \
90+
-e '1icargo-features = ["edition2024"]' \
91+
-e 's/edition = "2021"/edition = "2024"/' \
92+
$i/Cargo.toml
93+
done
94+
95+
- name: Install toolchain
96+
run: rustup show active-toolchain
97+
98+
# Run
99+
- name: Build
100+
run: cargo build --tests --features internal
101+
102+
- name: Test
103+
run: cargo test --features internal
104+
105+
- name: Test clippy_lints
106+
run: cargo test --features internal
107+
working-directory: clippy_lints
108+
109+
- name: Test clippy_utils
110+
run: cargo test
111+
working-directory: clippy_utils
112+
113+
- name: Test rustc_tools_util
114+
run: cargo test
115+
working-directory: rustc_tools_util
116+
117+
- name: Test clippy_dev
118+
run: cargo test
119+
working-directory: clippy_dev
120+
121+
- name: Test clippy-driver
122+
run: .github/driver.sh
123+
env:
124+
OS: ${{ runner.os }}

.github/workflows/clippy_bors.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,19 @@ jobs:
5757
include:
5858
- os: ubuntu-latest
5959
host: x86_64-unknown-linux-gnu
60+
edition: 2021
61+
- os: ubuntu-latest
62+
host: x86_64-unknown-linux-gnu
63+
edition: 2024
6064
- os: ubuntu-latest
6165
host: i686-unknown-linux-gnu
66+
edition: 2021
6267
- os: windows-latest
6368
host: x86_64-pc-windows-msvc
69+
edition: 2021
6470
- os: macos-13
6571
host: x86_64-apple-darwin
72+
edition: 2021
6673

6774
runs-on: ${{ matrix.os }}
6875

@@ -79,6 +86,16 @@ jobs:
7986
sudo apt-get update
8087
sudo apt-get install gcc-multilib zlib1g-dev:i386
8188
89+
- name: Select Rust 2024 edition
90+
if: matrix.edition == 2024
91+
run: |
92+
for i in clippy_config clippy_dev clippy_lints clippy_utils lintcheck; do
93+
sed -i \
94+
-e '1icargo-features = ["edition2024"]' \
95+
-e 's/edition = "2021"/edition = "2024"/' \
96+
$i/Cargo.toml
97+
done
98+
8299
- name: Install toolchain
83100
run: |
84101
rustup set default-host ${{ matrix.host }}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5689,13 +5689,15 @@ Released 2018-09-13
56895689
[`manual_unwrap_or_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
56905690
[`manual_while_let_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_while_let_some
56915691
[`many_single_char_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names
5692+
[`map_all_any_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_all_any_identity
56925693
[`map_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
56935694
[`map_collect_result_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_collect_result_unit
56945695
[`map_entry`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
56955696
[`map_err_ignore`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_err_ignore
56965697
[`map_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
56975698
[`map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
56985699
[`map_unwrap_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
5700+
[`map_with_unused_argument_over_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_with_unused_argument_over_ranges
56995701
[`match_as_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_as_ref
57005702
[`match_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_bool
57015703
[`match_like_matches_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro

book/src/lint_configuration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ default configuration of Clippy. By default, any configuration will replace the
456456
* `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
457457
* `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
458458

459-
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "MHz", "GHz", "THz", "AccessKit", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
459+
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "MHz", "GHz", "THz", "AccessKit", "CoAP", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
460460

461461
---
462462
**Affected lints:**
@@ -710,6 +710,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
710710
* [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold)
711711
* [`map_clone`](https://rust-lang.github.io/rust-clippy/master/index.html#map_clone)
712712
* [`map_unwrap_or`](https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or)
713+
* [`map_with_unused_argument_over_ranges`](https://rust-lang.github.io/rust-clippy/master/index.html#map_with_unused_argument_over_ranges)
713714
* [`match_like_matches_macro`](https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro)
714715
* [`mem_replace_with_default`](https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default)
715716
* [`missing_const_for_fn`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn)

clippy_config/src/conf.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
1919
"KiB", "MiB", "GiB", "TiB", "PiB", "EiB",
2020
"MHz", "GHz", "THz",
2121
"AccessKit",
22-
"CoreFoundation", "CoreGraphics", "CoreText",
22+
"CoAP", "CoreFoundation", "CoreGraphics", "CoreText",
2323
"DevOps",
2424
"Direct2D", "Direct3D", "DirectWrite", "DirectX",
2525
"ECMAScript",
@@ -573,6 +573,7 @@ define_Conf! {
573573
manual_try_fold,
574574
map_clone,
575575
map_unwrap_or,
576+
map_with_unused_argument_over_ranges,
576577
match_like_matches_macro,
577578
mem_replace_with_default,
578579
missing_const_for_fn,

clippy_config/src/msrvs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ macro_rules! msrv_aliases {
1919
// names may refer to stabilized feature flags or library items
2020
msrv_aliases! {
2121
1,83,0 { CONST_EXTERN_FN, CONST_FLOAT_BITS_CONV, CONST_FLOAT_CLASSIFY }
22-
1,82,0 { IS_NONE_OR }
22+
1,82,0 { IS_NONE_OR, REPEAT_N }
2323
1,81,0 { LINT_REASONS_STABILIZATION }
2424
1,80,0 { BOX_INTO_ITER}
2525
1,77,0 { C_STR_LITERALS }
@@ -55,7 +55,7 @@ msrv_aliases! {
5555
1,33,0 { UNDERSCORE_IMPORTS }
5656
1,30,0 { ITERATOR_FIND_MAP, TOOL_ATTRIBUTES }
5757
1,29,0 { ITER_FLATTEN }
58-
1,28,0 { FROM_BOOL }
58+
1,28,0 { FROM_BOOL, REPEAT_WITH }
5959
1,27,0 { ITERATOR_TRY_FOLD }
6060
1,26,0 { RANGE_INCLUSIVE, STRING_RETAIN }
6161
1,24,0 { IS_ASCII_DIGIT }

clippy_lints/src/casts/unnecessary_cast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ fn is_cast_from_ty_alias<'tcx>(cx: &LateContext<'tcx>, expr: impl Visitable<'tcx
268268
if !snippet
269269
.split("->")
270270
.skip(1)
271-
.map(|s| snippet_eq_ty(s, cast_from) || s.split("where").any(|ty| snippet_eq_ty(ty, cast_from)))
272-
.any(|a| a)
271+
.any(|s| snippet_eq_ty(s, cast_from) || s.split("where").any(|ty| snippet_eq_ty(ty, cast_from)))
273272
{
274273
return ControlFlow::Break(());
275274
}

clippy_lints/src/checked_conversions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn get_types_from_cast<'a>(
232232
// or `to_type::MAX as from_type`
233233
let call_from_cast: Option<(&Expr<'_>, &str)> = if let ExprKind::Cast(limit, from_type) = &expr.kind
234234
// to_type::max_value(), from_type
235-
&& let TyKind::Path(ref from_type_path) = &from_type.kind
235+
&& let TyKind::Path(from_type_path) = &from_type.kind
236236
&& let Some(from_sym) = int_ty_to_sym(from_type_path)
237237
{
238238
Some((limit, from_sym))
@@ -245,7 +245,7 @@ fn get_types_from_cast<'a>(
245245
if let ExprKind::Call(from_func, [limit]) = &expr.kind
246246
// `from_type::from, to_type::max_value()`
247247
// `from_type::from`
248-
&& let ExprKind::Path(ref path) = &from_func.kind
248+
&& let ExprKind::Path(path) = &from_func.kind
249249
&& let Some(from_sym) = get_implementing_type(path, INTS, "from")
250250
{
251251
Some((limit, from_sym))

clippy_lints/src/copy_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
3737
impl<'tcx> LateLintPass<'tcx> for CopyIterator {
3838
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3939
if let ItemKind::Impl(Impl {
40-
of_trait: Some(ref trait_ref),
40+
of_trait: Some(trait_ref),
4141
..
4242
}) = item.kind
4343
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()

clippy_lints/src/declared_lints.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,14 @@ pub static LINTS: &[&crate::LintInfo] = &[
416416
crate::methods::MANUAL_SPLIT_ONCE_INFO,
417417
crate::methods::MANUAL_STR_REPEAT_INFO,
418418
crate::methods::MANUAL_TRY_FOLD_INFO,
419+
crate::methods::MAP_ALL_ANY_IDENTITY_INFO,
419420
crate::methods::MAP_CLONE_INFO,
420421
crate::methods::MAP_COLLECT_RESULT_UNIT_INFO,
421422
crate::methods::MAP_ERR_IGNORE_INFO,
422423
crate::methods::MAP_FLATTEN_INFO,
423424
crate::methods::MAP_IDENTITY_INFO,
424425
crate::methods::MAP_UNWRAP_OR_INFO,
426+
crate::methods::MAP_WITH_UNUSED_ARGUMENT_OVER_RANGES_INFO,
425427
crate::methods::MUT_MUTEX_LOCK_INFO,
426428
crate::methods::NAIVE_BYTECOUNT_INFO,
427429
crate::methods::NEEDLESS_AS_BYTES_INFO,

0 commit comments

Comments
 (0)