From dca10d17dbfddf373e7cadc80c89825bbbfb99a6 Mon Sep 17 00:00:00 2001
From: Ed Page <eopage@gmail.com>
Date: Wed, 8 Jun 2022 17:10:09 -0500
Subject: [PATCH 1/2] chore: Allow warnings during development

---
 src/cargo/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs
index 201d4316915..59b197870af 100644
--- a/src/cargo/lib.rs
+++ b/src/cargo/lib.rs
@@ -1,7 +1,7 @@
 // For various reasons, some idioms are still allow'ed, but we would like to
 // test and enforce them.
 #![warn(rust_2018_idioms)]
-#![cfg_attr(test, deny(warnings))]
+#![cfg_attr(feature = "deny-warnings", deny(warnings))]
 // Due to some of the default clippy lints being somewhat subjective and not
 // necessarily an improvement, we prefer to not use them at this time.
 #![allow(clippy::all)]

From d52f29897a4a5d372d457ebf609808f9dc110001 Mon Sep 17 00:00:00 2001
From: Ed Page <eopage@gmail.com>
Date: Fri, 10 Feb 2023 16:17:33 -0600
Subject: [PATCH 2/2] chore: Deny warnings across entire cargo repo

---
 .github/workflows/main.yml           | 9 +++++----
 Cargo.toml                           | 1 -
 crates/cargo-test-support/Cargo.toml | 3 ---
 crates/cargo-test-support/src/lib.rs | 1 -
 src/cargo/lib.rs                     | 1 -
 tests/testsuite/main.rs              | 1 -
 6 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 76aa79dd313..c732b23fcc1 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -35,6 +35,8 @@ jobs:
       CARGO_PROFILE_TEST_DEBUG: 1
       CARGO_INCREMENTAL: 0
       CARGO_PUBLIC_NETWORK_TESTS: 1
+      # Deny warnings on CI to avoid warnings getting into the codebase.
+      RUSTFLAGS: -D warnings
     strategy:
       matrix:
         include:
@@ -85,8 +87,7 @@ jobs:
       run: echo CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse >> $GITHUB_ENV
       if: "!contains(matrix.rust, 'stable')"
 
-    # Deny warnings on CI to avoid warnings getting into the codebase.
-    - run: cargo test --features 'deny-warnings'
+    - run: cargo test
     # The testsuite generates a huge amount of data, and fetch-smoke-test was
     # running out of disk space.
     - name: Clear test output
@@ -100,8 +101,8 @@ jobs:
       run: |
         # This only tests `cargo fix` because fix-proxy-mode is one of the most
         # complicated subprocess management in Cargo.
-        cargo test --test testsuite --features 'deny-warnings' -- fix::
-    - run: cargo test --features 'deny-warnings' --manifest-path crates/cargo-test-support/Cargo.toml
+        cargo test --test testsuite -- fix::
+    - run: cargo test --manifest-path crates/cargo-test-support/Cargo.toml
       env:
         CARGO_TARGET_DIR: target
     - run: cargo test -p cargo-platform
diff --git a/Cargo.toml b/Cargo.toml
index 9b96a75339c..56a65f39c5e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -112,7 +112,6 @@ test = false
 doc = false
 
 [features]
-deny-warnings = []
 vendored-openssl = ["openssl/vendored"]
 vendored-libgit2 = ["libgit2-sys/vendored"]
 pretty-env-logger = ["pretty_env_logger"]
diff --git a/crates/cargo-test-support/Cargo.toml b/crates/cargo-test-support/Cargo.toml
index 89eb94a5ef7..5a87ee0bef3 100644
--- a/crates/cargo-test-support/Cargo.toml
+++ b/crates/cargo-test-support/Cargo.toml
@@ -30,6 +30,3 @@ url = "2.2.2"
 
 [target.'cfg(windows)'.dependencies]
 windows-sys = { version = "0.45.0", features = ["Win32_Storage_FileSystem"] }
-
-[features]
-deny-warnings = []
diff --git a/crates/cargo-test-support/src/lib.rs b/crates/cargo-test-support/src/lib.rs
index c8936c3e144..64efa03a96b 100644
--- a/crates/cargo-test-support/src/lib.rs
+++ b/crates/cargo-test-support/src/lib.rs
@@ -3,7 +3,6 @@
 //! See <https://rust-lang.github.io/cargo/contrib/> for a guide on writing tests.
 
 #![allow(clippy::all)]
-#![cfg_attr(feature = "deny-warnings", deny(warnings))]
 
 use std::env;
 use std::ffi::OsStr;
diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs
index 59b197870af..435d582a378 100644
--- a/src/cargo/lib.rs
+++ b/src/cargo/lib.rs
@@ -1,7 +1,6 @@
 // For various reasons, some idioms are still allow'ed, but we would like to
 // test and enforce them.
 #![warn(rust_2018_idioms)]
-#![cfg_attr(feature = "deny-warnings", deny(warnings))]
 // Due to some of the default clippy lints being somewhat subjective and not
 // necessarily an improvement, we prefer to not use them at this time.
 #![allow(clippy::all)]
diff --git a/tests/testsuite/main.rs b/tests/testsuite/main.rs
index 76d3f22dae9..66914e4dfd8 100644
--- a/tests/testsuite/main.rs
+++ b/tests/testsuite/main.rs
@@ -1,7 +1,6 @@
 // See src/cargo/lib.rs for notes on these lint settings.
 #![warn(rust_2018_idioms)]
 #![allow(clippy::all)]
-#![cfg_attr(feature = "deny-warnings", deny(warnings))]
 
 #[macro_use]
 extern crate cargo_test_macro;