Skip to content

Commit e46d97c

Browse files
committed
Auto merge of #12178 - weihanglo:dogfood-lints-table, r=epage
chore: dogfood Cargo `-Zlints` table feature
2 parents 6c3f403 + e2f5925 commit e46d97c

File tree

45 files changed

+135
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+135
-49
lines changed

.github/workflows/main.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ jobs:
6666
- uses: actions/checkout@v4
6767
- run: rustup update stable && rustup default stable
6868
- run: rustup component add clippy
69-
# Only check cargo lib for now
70-
# TODO: check every members
71-
- run: cargo clippy -p cargo --lib --no-deps -- -D warnings
69+
- run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
7270

7371
stale-label:
7472
runs-on: ubuntu-latest
@@ -110,8 +108,6 @@ jobs:
110108
CARGO_PROFILE_TEST_DEBUG: 1
111109
CARGO_INCREMENTAL: 0
112110
CARGO_PUBLIC_NETWORK_TESTS: 1
113-
# Deny warnings on CI to avoid warnings getting into the codebase.
114-
RUSTFLAGS: -D warnings
115111
strategy:
116112
matrix:
117113
include:

Cargo.lock

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+17
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ varisat = "0.2.2"
106106
walkdir = "2.4.0"
107107
windows-sys = "0.48"
108108

109+
[workspace.lints.rust]
110+
rust_2018_idioms = "warn" # TODO: could this be removed?
111+
112+
[workspace.lints.rustdoc]
113+
private_intra_doc_links = "allow"
114+
115+
[workspace.lints.clippy]
116+
all = { level = "allow", priority = -1 }
117+
dbg_macro = "warn"
118+
disallowed_methods = "warn"
119+
print_stderr = "warn"
120+
print_stdout = "warn"
121+
self_named_module_files = "warn"
122+
109123
[package]
110124
name = "cargo"
111125
version = "0.77.0"
@@ -234,3 +248,6 @@ vendored-openssl = ["openssl/vendored"]
234248
vendored-libgit2 = ["libgit2-sys/vendored"]
235249
# This is primarily used by rust-lang/rust distributing cargo the executable.
236250
all-static = ['vendored-openssl', 'curl/static-curl', 'curl/force-system-lib-on-osx']
251+
252+
[lints]
253+
workspace = true

benches/benchsuite/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ harness = false
3232
[[bench]]
3333
name = "global_cache_tracker"
3434
harness = false
35+
36+
[lints]
37+
workspace = true

benches/benchsuite/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::disallowed_methods)]
2+
13
use cargo::Config;
24
use std::fs;
35
use std::path::{Path, PathBuf};

benches/capture/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ cargo_metadata.workspace = true
1212
flate2.workspace = true
1313
tar.workspace = true
1414
toml.workspace = true
15+
16+
[lints]
17+
workspace = true

benches/capture/src/main.rs

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
//! Use the `-f` flag to allow it to overwrite existing captures.
55
//! The workspace will be saved in a `.tgz` file in the `../workspaces` directory.
66
7+
#![allow(clippy::disallowed_methods)]
8+
#![allow(clippy::print_stderr)]
9+
710
use flate2::{Compression, GzBuilder};
811
use std::fs;
912
use std::path::{Path, PathBuf};

crates/cargo-platform/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-platform"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
edition.workspace = true
55
license.workspace = true
66
rust-version = "1.70.0" # MSRV:3
@@ -11,3 +11,6 @@ description = "Cargo's representation of a target platform."
1111

1212
[dependencies]
1313
serde.workspace = true
14+
15+
[lints]
16+
workspace = true

crates/cargo-platform/examples/matches.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! This example demonstrates how to filter a Platform based on the current
22
//! host target.
33
4+
#![allow(clippy::print_stdout)]
5+
46
use cargo_platform::{Cfg, Platform};
57
use std::process::Command;
68
use std::str::FromStr;

crates/cargo-test-macro/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ publish = false
1212

1313
[lib]
1414
proc-macro = true
15+
16+
[lints]
17+
workspace = true

crates/cargo-test-support/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ walkdir.workspace = true
3333

3434
[target.'cfg(windows)'.dependencies]
3535
windows-sys = { workspace = true, features = ["Win32_Storage_FileSystem"] }
36+
37+
[lints]
38+
workspace = true

crates/cargo-test-support/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::disallowed_methods)]
2+
13
fn main() {
24
println!(
35
"cargo:rustc-env=NATIVE_ARCH={}",

crates/cargo-test-support/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
//!
33
//! See <https://rust-lang.github.io/cargo/contrib/> for a guide on writing tests.
44
5-
#![allow(clippy::all)]
5+
#![allow(clippy::disallowed_methods)]
6+
#![allow(clippy::print_stderr)]
7+
#![allow(clippy::print_stdout)]
68

79
use std::env;
810
use std::ffi::OsStr;

crates/cargo-util/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ core-foundation.workspace = true
2828
[target.'cfg(windows)'.dependencies]
2929
miow.workspace = true
3030
windows-sys = { workspace = true, features = ["Win32_Storage_FileSystem", "Win32_Foundation", "Win32_System_Console"] }
31+
32+
[lints]
33+
workspace = true

crates/cargo-util/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Miscellaneous support code used by Cargo.
22
3+
#![allow(clippy::disallowed_methods)]
4+
35
pub use self::read2::read2;
46
pub use du::du;
57
pub use process_builder::ProcessBuilder;

crates/crates-io/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "crates-io"
3-
version = "0.39.1"
3+
version = "0.39.2"
44
rust-version.workspace = true
55
edition.workspace = true
66
license.workspace = true
@@ -20,3 +20,6 @@ serde = { workspace = true, features = ["derive"] }
2020
serde_json.workspace = true
2121
thiserror.workspace = true
2222
url.workspace = true
23+
24+
[lints]
25+
workspace = true

crates/crates-io/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(clippy::all)]
2-
31
use std::collections::BTreeMap;
42
use std::fs::File;
53
use std::io::prelude::*;

crates/home/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "home"
3-
version = "0.5.8"
3+
version = "0.5.9"
44
authors = ["Brian Anderson <[email protected]>"]
55
rust-version = "1.70.0" # MSRV:3
66
documentation = "https://docs.rs/home"
@@ -18,3 +18,6 @@ description = "Shared definitions of home directories."
1818

1919
[target.'cfg(windows)'.dependencies]
2020
windows-sys = { workspace = true, features = ["Win32_Foundation", "Win32_UI_Shell"] }
21+
22+
[lints]
23+
workspace = true

crates/home/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//!
1919
//! [discussion]: https://github.com/rust-lang/rust/pull/46799#issuecomment-361156935
2020
21-
#![deny(rust_2018_idioms)]
21+
#![allow(clippy::disallowed_methods)]
2222

2323
pub mod env;
2424

crates/mdman/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ url.workspace = true
1717

1818
[dev-dependencies]
1919
pretty_assertions.workspace = true
20+
21+
[lints]
22+
workspace = true

crates/mdman/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::print_stderr)]
2+
13
use anyhow::{bail, format_err, Context, Error};
24
use mdman::{Format, ManMap};
35
use std::collections::HashMap;

crates/mdman/tests/compare.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! Use the MDMAN_BLESS environment variable to automatically update the
44
//! expected output.
55
6+
#![allow(clippy::disallowed_methods)]
7+
68
use mdman::{Format, ManMap};
79
use pretty_assertions::assert_eq;
810
use std::path::PathBuf;

crates/resolver-tests/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ cargo.workspace = true
1010
cargo-util.workspace = true
1111
proptest.workspace = true
1212
varisat.workspace = true
13+
14+
[lints]
15+
workspace = true

crates/resolver-tests/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::all)]
1+
#![allow(clippy::print_stderr)]
22

33
use std::cell::RefCell;
44
use std::cmp::PartialEq;

crates/semver-check/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ publish = false
1010

1111
[dependencies]
1212
tempfile.workspace = true
13+
14+
[lints]
15+
workspace = true

crates/semver-check/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
//! - `dont-deny`: By default tests have a `#![deny(warnings)]`. This option
1414
//! avoids this attribute. Note that `#![allow(unused)]` is always added.
1515
16+
#![allow(clippy::print_stderr)]
17+
1618
use std::error::Error;
1719
use std::fs;
1820
use std::path::Path;

crates/xtask-build-man/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ edition.workspace = true
66
publish = false
77

88
[dependencies]
9+
10+
[lints]
11+
workspace = true

crates/xtask-build-man/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//! For more, read their doc comments.
1111
//! ```
1212
13+
#![allow(clippy::print_stderr)]
14+
1315
use std::fs;
1416
use std::io;
1517
use std::path::PathBuf;

crates/xtask-bump-check/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ git2.workspace = true
1414
semver.workspace = true
1515
tracing-subscriber.workspace = true
1616
tracing.workspace = true
17+
18+
[lints]
19+
workspace = true

crates/xtask-stale-label/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ publish = false
77

88
[dependencies]
99
toml_edit.workspace = true
10+
11+
[lints]
12+
workspace = true

crates/xtask-stale-label/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//! Probably autofix them in the future.
1111
//! ```
1212
13+
#![allow(clippy::print_stderr)]
14+
1315
use std::fmt::Write as _;
1416
use std::path::PathBuf;
1517
use std::process;

credential/cargo-credential-1password/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-credential-1password"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
edition.workspace = true
55
license.workspace = true
66
rust-version = "1.70.0" # MSRV:3
@@ -11,3 +11,6 @@ description = "A Cargo credential process that stores tokens in a 1password vaul
1111
cargo-credential.workspace = true
1212
serde = { workspace = true, features = ["derive"] }
1313
serde_json.workspace = true
14+
15+
[lints]
16+
workspace = true

credential/cargo-credential-1password/src/main.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! Cargo registry 1password credential process.
22
3+
#![allow(clippy::disallowed_methods)]
4+
#![allow(clippy::print_stderr)]
5+
36
use cargo_credential::{
47
Action, CacheControl, Credential, CredentialResponse, Error, RegistryInfo, Secret,
58
};

0 commit comments

Comments
 (0)