Skip to content

Commit 00a64e4

Browse files
committed
fix: Only run lints when cargo-lints are enabled
1 parent b89864c commit 00a64e4

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/cargo/core/workspace.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,9 @@ impl<'gctx> Workspace<'gctx> {
11591159
for (path, maybe_pkg) in &self.packages.packages {
11601160
let path = path.join("Cargo.toml");
11611161
if let MaybePackage::Package(pkg) = maybe_pkg {
1162-
self.emit_lints(pkg, &path)?
1162+
if self.gctx.cli_unstable().cargo_lints {
1163+
self.emit_lints(pkg, &path)?
1164+
}
11631165
}
11641166
let warnings = match maybe_pkg {
11651167
MaybePackage::Package(pkg) => pkg.manifest().warnings().warnings(),

tests/testsuite/lints/unused_optional_dependencies/edition_2024/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ target-dep = { version = "0.1.0", optional = true }
3333
.build();
3434

3535
snapbox::cmd::Command::cargo_ui()
36-
.masquerade_as_nightly_cargo(&["edition2024"])
36+
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
3737
.current_dir(p.root())
3838
.arg("check")
39+
.arg("-Zcargo-lints")
3940
.assert()
4041
.success()
4142
.stdout_matches(str![""])

tests/testsuite/lints/unused_optional_dependencies/renamed_deps/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ target-dep = { version = "0.1.0", optional = true }
3232
.build();
3333

3434
snapbox::cmd::Command::cargo_ui()
35-
.masquerade_as_nightly_cargo(&["edition2024"])
35+
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
3636
.current_dir(p.root())
3737
.arg("check")
38+
.arg("-Zcargo-lints")
3839
.assert()
3940
.success()
4041
.stdout_matches(str![""])

0 commit comments

Comments
 (0)