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

Select Rust edition 2024 for compiling Clippy #13751

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install mdbook
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.34/mdbook-v0.4.34-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.43/mdbook-v0.4.43-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH

# Run
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0"
keywords = ["clippy", "lint", "plugin"]
categories = ["development-tools", "development-tools::cargo-plugins"]
build = "build.rs"
edition = "2021"
edition = "2024"
publish = false

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ src = "src"
title = "Clippy Documentation"

[rust]
edition = "2018"
edition = "2024"

[output.html]
edit-url-template = "https://github.com/rust-lang/rust-clippy/edit/master/book/{path}"
Expand Down
4 changes: 2 additions & 2 deletions book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ via `Tools -> Clippy` and you should see the generated code in the output below.
If the command was executed successfully, you can copy the code over to where
you are implementing your lint.

[author_example]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=9a12cb60e5c6ad4e3003ac6d5e63cf55
[author_example]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=9a12cb60e5c6ad4e3003ac6d5e63cf55

## Print HIR lint

Expand All @@ -552,7 +552,7 @@ attribute to expressions you often need to enable
_Clippy_.

[_High-Level Intermediate Representation (HIR)_]: https://rustc-dev-guide.rust-lang.org/hir.html
[print_hir_example]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=daf14db3a7f39ca467cd1b86c34b9afb
[print_hir_example]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=daf14db3a7f39ca467cd1b86c34b9afb

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "clippy_config"
# begin autogenerated version
version = "0.1.86"
# end autogenerated version
edition = "2021"
edition = "2024"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "clippy_dev"
description = "Clippy developer tooling"
version = "0.0.1"
edition = "2021"
edition = "2024"

[dependencies]
aho-corasick = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion clippy_dummy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "clippy_dummy" # rename to clippy before publishing
version = "0.0.303"
edition = "2018"
edition = "2024"
readme = "crates-readme.md"
description = "A bunch of helpful lints to avoid common pitfalls in Rust."
build = 'build.rs'
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
license = "MIT OR Apache-2.0"
keywords = ["clippy", "lint", "plugin"]
edition = "2021"
edition = "2024"

[dependencies]
arrayvec = { version = "0.7", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "clippy_utils"
# begin autogenerated version
version = "0.1.86"
# end autogenerated version
edition = "2021"
edition = "2024"
description = "Helpful tools for writing lints, provided as they are used in Clippy"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion lintcheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust-clippy"
categories = ["development-tools"]
edition = "2021"
edition = "2024"
publish = false
default-run = "lintcheck"

Expand Down
2 changes: 1 addition & 1 deletion rustc_tools_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ readme = "README.md"
license = "MIT OR Apache-2.0"
keywords = ["rustc", "tool", "git", "version", "hash"]
categories = ["development-tools"]
edition = "2018"
edition = "2024"

[dependencies]
4 changes: 2 additions & 2 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ max_width = 120
comment_width = 100
match_block_trailing_comma = true
wrap_comments = true
edition = "2021"
edition = "2024"
error_on_line_overflow = true
imports_granularity = "Module"
version = "Two"
style_edition = "2024"
ignore = ["tests/ui/crashes/ice-10912.rs"]
4 changes: 3 additions & 1 deletion tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ fn run_ui_cargo(cx: &TestContext) {
}

fn main() {
set_var("CLIPPY_DISABLE_DOCS_LINKS", "true");
unsafe {
set_var("CLIPPY_DISABLE_DOCS_LINKS", "true");
}

let cx = TestContext::new();

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/crashes/ice-11422.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::fmt::Debug;
use std::ops::*;

fn gen() -> impl PartialOrd + Debug {}
fn r#gen() -> impl PartialOrd + Debug {}

struct Bar {}
trait Foo<T = Self> {}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/crashes/ice-11422.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::fmt::Debug;
use std::ops::*;

fn gen() -> impl PartialOrd + PartialEq + Debug {}
fn r#gen() -> impl PartialOrd + PartialEq + Debug {}

struct Bar {}
trait Foo<T = Self> {}
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/crashes/ice-11422.stderr
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
error: this bound is already specified as the supertrait of `PartialOrd`
--> tests/ui/crashes/ice-11422.rs:6:31
--> tests/ui/crashes/ice-11422.rs:6:33
|
LL | fn gen() -> impl PartialOrd + PartialEq + Debug {}
| ^^^^^^^^^
LL | fn r#gen() -> impl PartialOrd + PartialEq + Debug {}
| ^^^^^^^^^
|
= note: `-D clippy::implied-bounds-in-impls` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::implied_bounds_in_impls)]`
help: try removing this bound
|
LL - fn gen() -> impl PartialOrd + PartialEq + Debug {}
LL + fn gen() -> impl PartialOrd + Debug {}
LL - fn r#gen() -> impl PartialOrd + PartialEq + Debug {}
LL + fn r#gen() -> impl PartialOrd + Debug {}
|

error: aborting due to 1 previous error
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/implicit_hasher.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn map<S: ::std::hash::BuildHasher>(map: &mut HashMap<i32, i32, S>) {}
pub fn set<S: ::std::hash::BuildHasher>(set: &mut HashSet<i32, S>) {}

#[inline_macros]
pub mod gen {
pub mod gen_ {
use super::*;
inline! {
impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/implicit_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn map(map: &mut HashMap<i32, i32>) {}
pub fn set(set: &mut HashSet<i32>) {}

#[inline_macros]
pub mod gen {
pub mod gen_ {
use super::*;
inline! {
impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/implicit_hasher.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ error: impl for `HashMap` should be generalized over different hashers
LL | impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
| ^^^^^^^^^^^^^
|
= note: this error originates in the macro `__inline_mac_mod_gen` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the macro `__inline_mac_mod_gen_` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add a type parameter for `BuildHasher`
|
LL ~ impl<K: Hash + Eq, V, S: ::std::hash::BuildHasher + Default> Foo<u8> for HashMap<K, V, S> {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/map_with_unused_argument_over_ranges.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn do_something_interesting(x: usize, y: usize) -> usize {
todo!()
}

macro_rules! gen {
macro_rules! r#gen {
() => {
(0..10).map(|_| do_something());
};
Expand Down Expand Up @@ -45,7 +45,7 @@ fn main() {
std::iter::repeat_with(|| do_something()).take(1);
std::iter::repeat_with(|| do_something()).take((1 << 4) - 0);
// These should not be raised
gen!();
r#gen!();
let lower = 2;
let lower_fn = || 2;
(lower..upper_fn()).map(|_| do_something()); // Ranges not starting at zero not yet handled
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/map_with_unused_argument_over_ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn do_something_interesting(x: usize, y: usize) -> usize {
todo!()
}

macro_rules! gen {
macro_rules! r#gen {
() => {
(0..10).map(|_| do_something());
};
Expand Down Expand Up @@ -45,7 +45,7 @@ fn main() {
(9..=9).map(|_| do_something());
(1..=1 << 4).map(|_| do_something());
// These should not be raised
gen!();
r#gen!();
let lower = 2;
let lower_fn = || 2;
(lower..upper_fn()).map(|_| do_something()); // Ranges not starting at zero not yet handled
Expand Down
Loading