Skip to content

Commit 57876c0

Browse files
committed
Run CI checks for Rust 2024 as well
4 parents a304709 + 540e116 + 0c1ef98 + 8052451 commit 57876c0

40 files changed

+297
-93
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 }}

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/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex
187187
impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
188188
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
189189
if let ItemKind::Impl(Impl {
190-
of_trait: Some(ref trait_ref),
190+
of_trait: Some(trait_ref),
191191
items: [child],
192192
self_ty,
193193
..

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ declare_lint_pass!(Derive => [
202202
impl<'tcx> LateLintPass<'tcx> for Derive {
203203
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
204204
if let ItemKind::Impl(Impl {
205-
of_trait: Some(ref trait_ref),
205+
of_trait: Some(trait_ref),
206206
..
207207
}) = item.kind
208208
{

clippy_lints/src/disallowed_script_idents.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl EarlyLintPass for DisallowedScriptIdents {
8080
let mut symbols: Vec<_> = symbols.iter().collect();
8181
symbols.sort_unstable_by_key(|k| k.1);
8282

83-
for (symbol, &span) in &symbols {
83+
for &(symbol, &span) in &symbols {
8484
// Note: `symbol.as_str()` is an expensive operation, thus should not be called
8585
// more than once for a single symbol.
8686
let symbol_str = symbol.as_str();

clippy_lints/src/empty_drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ declare_lint_pass!(EmptyDrop => [EMPTY_DROP]);
3636
impl LateLintPass<'_> for EmptyDrop {
3737
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
3838
if let ItemKind::Impl(Impl {
39-
of_trait: Some(ref trait_ref),
39+
of_trait: Some(trait_ref),
4040
items: [child],
4141
..
4242
}) = item.kind

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
629629
.filter_by_name_unhygienic(is_empty)
630630
.any(|item| is_is_empty(cx, item))
631631
}),
632-
ty::Alias(ty::Projection, ref proj) => has_is_empty_impl(cx, proj.def_id),
632+
ty::Alias(ty::Projection, proj) => has_is_empty_impl(cx, proj.def_id),
633633
ty::Adt(id, _) => has_is_empty_impl(cx, id.did()),
634634
ty::Array(..) | ty::Slice(..) | ty::Str => true,
635635
_ => false,

clippy_lints/src/lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
425425
self.visit_opaque_ty(opaque);
426426
self.lts.truncate(len);
427427
self.lts.extend(bounds.iter().filter_map(|bound| match bound {
428-
GenericArg::Lifetime(&l) => Some(l),
428+
&GenericArg::Lifetime(l) => Some(l),
429429
_ => None,
430430
}));
431431
},

0 commit comments

Comments
 (0)