mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
refactor: Remove rust_2024_compatibility
lint group
This commit is contained in:
parent
74fd5bc730
commit
d77faa68af
@ -66,13 +66,6 @@ pub struct LintGroup {
|
|||||||
pub edition_lint_opts: Option<(Edition, LintLevel)>,
|
pub edition_lint_opts: Option<(Edition, LintLevel)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const RUST_2024_COMPATIBILITY: LintGroup = LintGroup {
|
|
||||||
name: "rust_2024_compatibility",
|
|
||||||
default_level: LintLevel::Allow,
|
|
||||||
desc: "warn about compatibility with Rust 2024",
|
|
||||||
edition_lint_opts: Some((Edition::Edition2024, LintLevel::Deny)),
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct Lint {
|
pub struct Lint {
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
@ -152,7 +145,7 @@ impl From<TomlLintLevel> for LintLevel {
|
|||||||
const IMPLICIT_FEATURES: Lint = Lint {
|
const IMPLICIT_FEATURES: Lint = Lint {
|
||||||
name: "implicit_features",
|
name: "implicit_features",
|
||||||
desc: "warn about the use of unstable features",
|
desc: "warn about the use of unstable features",
|
||||||
groups: &[RUST_2024_COMPATIBILITY],
|
groups: &[],
|
||||||
default_level: LintLevel::Allow,
|
default_level: LintLevel::Allow,
|
||||||
edition_lint_opts: Some((Edition::Edition2024, LintLevel::Deny)),
|
edition_lint_opts: Some((Edition::Edition2024, LintLevel::Deny)),
|
||||||
};
|
};
|
||||||
|
@ -1,2 +1 @@
|
|||||||
mod implicit_features;
|
mod implicit_features;
|
||||||
mod rust_2024_compatibility;
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
use cargo_test_support::prelude::*;
|
|
||||||
use cargo_test_support::project;
|
|
||||||
use cargo_test_support::registry::Package;
|
|
||||||
use cargo_test_support::str;
|
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn case() {
|
|
||||||
Package::new("bar", "0.1.0").publish();
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bar = { version = "0.1.0", optional = true }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
snapbox::cmd::Command::cargo_ui()
|
|
||||||
.masquerade_as_nightly_cargo(&["always_nightly"])
|
|
||||||
.current_dir(p.root())
|
|
||||||
.arg("check")
|
|
||||||
.arg("--quiet")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout_matches(str![""])
|
|
||||||
.stderr_matches(str![""]);
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
use cargo_test_support::prelude::*;
|
|
||||||
use cargo_test_support::registry::Package;
|
|
||||||
use cargo_test_support::str;
|
|
||||||
use cargo_test_support::{file, project};
|
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn case() {
|
|
||||||
Package::new("bar", "0.1.0").publish();
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bar = { version = "0.1.0", optional = true }
|
|
||||||
|
|
||||||
[lints.cargo]
|
|
||||||
rust-2024-compatibility = "warn"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
snapbox::cmd::Command::cargo_ui()
|
|
||||||
.masquerade_as_nightly_cargo(&["always_nightly"])
|
|
||||||
.current_dir(p.root())
|
|
||||||
.arg("check")
|
|
||||||
.arg("--quiet")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout_matches(str![""])
|
|
||||||
.stderr_matches(file!["stderr.term.svg"]);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<style>
|
|
||||||
.fg { fill: #AAAAAA }
|
|
||||||
.bg { background: #000000 }
|
|
||||||
.fg-bright-blue { fill: #5555FF }
|
|
||||||
.fg-yellow { fill: #AA5500 }
|
|
||||||
.container {
|
|
||||||
padding: 0 10px;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
.bold { font-weight: bold; }
|
|
||||||
tspan {
|
|
||||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
|
||||||
white-space: pre;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
|
||||||
|
|
||||||
<text xml:space="preserve" class="container fg">
|
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-yellow bold">warning</tspan><tspan>: </tspan><tspan class="bold">unused optional dependency</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-bright-blue bold">--></tspan><tspan> Cargo.toml:8:1</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="64px"><tspan class="fg-bright-blue bold"> |</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">8 |</tspan><tspan> bar = { version = "0.1.0", optional = true }</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="100px"><tspan class="fg-bright-blue bold"> |</tspan><tspan class="fg-yellow bold"> ---</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="118px"><tspan class="fg-bright-blue bold"> |</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="136px">
|
|
||||||
</tspan>
|
|
||||||
</text>
|
|
||||||
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1,34 +0,0 @@
|
|||||||
use cargo_test_support::prelude::*;
|
|
||||||
use cargo_test_support::registry::Package;
|
|
||||||
use cargo_test_support::str;
|
|
||||||
use cargo_test_support::{file, project};
|
|
||||||
|
|
||||||
#[cargo_test(nightly, reason = "edition2024 is not stable")]
|
|
||||||
fn case() {
|
|
||||||
Package::new("bar", "0.1.0").publish();
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
cargo-features = ["edition2024"]
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bar = { version = "0.1.0", optional = true }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
snapbox::cmd::Command::cargo_ui()
|
|
||||||
.masquerade_as_nightly_cargo(&["always_nightly"])
|
|
||||||
.current_dir(p.root())
|
|
||||||
.arg("check")
|
|
||||||
.assert()
|
|
||||||
.code(101)
|
|
||||||
.stdout_matches(str![""])
|
|
||||||
.stderr_matches(file!["stderr.term.svg"]);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<style>
|
|
||||||
.fg { fill: #AAAAAA }
|
|
||||||
.bg { background: #000000 }
|
|
||||||
.fg-bright-blue { fill: #5555FF }
|
|
||||||
.fg-bright-red { fill: #FF5555 }
|
|
||||||
.container {
|
|
||||||
padding: 0 10px;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
.bold { font-weight: bold; }
|
|
||||||
tspan {
|
|
||||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
|
||||||
white-space: pre;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
|
||||||
|
|
||||||
<text xml:space="preserve" class="container fg">
|
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-bright-red bold">error</tspan><tspan>: </tspan><tspan class="bold">unused optional dependency</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-bright-blue bold">--></tspan><tspan> Cargo.toml:9:1</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="64px"><tspan class="fg-bright-blue bold"> |</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">9 |</tspan><tspan> bar = { version = "0.1.0", optional = true }</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="100px"><tspan class="fg-bright-blue bold"> |</tspan><tspan class="fg-bright-red bold"> ^^^</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="118px"><tspan class="fg-bright-blue bold"> |</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="136px">
|
|
||||||
</tspan>
|
|
||||||
</text>
|
|
||||||
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.4 KiB |
@ -1,4 +0,0 @@
|
|||||||
mod edition_2021;
|
|
||||||
mod edition_2021_warn;
|
|
||||||
mod edition_2024;
|
|
||||||
mod warn;
|
|
@ -1,38 +0,0 @@
|
|||||||
use cargo_test_support::prelude::*;
|
|
||||||
use cargo_test_support::registry::Package;
|
|
||||||
use cargo_test_support::str;
|
|
||||||
use cargo_test_support::{file, project};
|
|
||||||
|
|
||||||
#[cargo_test(nightly, reason = "edition2024 is not stable")]
|
|
||||||
fn case() {
|
|
||||||
Package::new("bar", "0.1.0").publish();
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
cargo-features = ["edition2024"]
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bar = { version = "0.1.0", optional = true }
|
|
||||||
|
|
||||||
[lints.cargo]
|
|
||||||
rust-2024-compatibility = "warn"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
snapbox::cmd::Command::cargo_ui()
|
|
||||||
.masquerade_as_nightly_cargo(&["always_nightly"])
|
|
||||||
.current_dir(p.root())
|
|
||||||
.arg("check")
|
|
||||||
.arg("--quiet")
|
|
||||||
.assert()
|
|
||||||
.success()
|
|
||||||
.stdout_matches(str![""])
|
|
||||||
.stderr_matches(file!["stderr.term.svg"]);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<style>
|
|
||||||
.fg { fill: #AAAAAA }
|
|
||||||
.bg { background: #000000 }
|
|
||||||
.fg-bright-blue { fill: #5555FF }
|
|
||||||
.fg-yellow { fill: #AA5500 }
|
|
||||||
.container {
|
|
||||||
padding: 0 10px;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
.bold { font-weight: bold; }
|
|
||||||
tspan {
|
|
||||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
|
||||||
white-space: pre;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
|
||||||
|
|
||||||
<text xml:space="preserve" class="container fg">
|
|
||||||
<tspan x="10px" y="28px"><tspan class="fg-yellow bold">warning</tspan><tspan>: </tspan><tspan class="bold">unused optional dependency</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-bright-blue bold">--></tspan><tspan> Cargo.toml:9:1</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="64px"><tspan class="fg-bright-blue bold"> |</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">9 |</tspan><tspan> bar = { version = "0.1.0", optional = true }</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="100px"><tspan class="fg-bright-blue bold"> |</tspan><tspan class="fg-yellow bold"> ---</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="118px"><tspan class="fg-bright-blue bold"> |</tspan>
|
|
||||||
</tspan>
|
|
||||||
<tspan x="10px" y="136px">
|
|
||||||
</tspan>
|
|
||||||
</text>
|
|
||||||
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.3 KiB |
Loading…
x
Reference in New Issue
Block a user