mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Auto merge of #12178 - weihanglo:dogfood-lints-table, r=epage
chore: dogfood Cargo `-Zlints` table feature
This commit is contained in:
commit
9f3b4883e8
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
@ -66,9 +66,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- run: rustup update stable && rustup default stable
|
||||
- run: rustup component add clippy
|
||||
# Only check cargo lib for now
|
||||
# TODO: check every members
|
||||
- run: cargo clippy -p cargo --lib --no-deps -- -D warnings
|
||||
- run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
|
||||
|
||||
stale-label:
|
||||
runs-on: ubuntu-latest
|
||||
@ -110,8 +108,6 @@ 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:
|
||||
|
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -252,7 +252,7 @@ dependencies = [
|
||||
"cargo-credential-libsecret",
|
||||
"cargo-credential-macos-keychain",
|
||||
"cargo-credential-wincred",
|
||||
"cargo-platform 0.1.6",
|
||||
"cargo-platform 0.1.7",
|
||||
"cargo-test-macro",
|
||||
"cargo-test-support",
|
||||
"cargo-util",
|
||||
@ -321,7 +321,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"libc",
|
||||
@ -344,7 +344,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential-libsecret"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo-credential",
|
||||
@ -353,7 +353,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential-macos-keychain"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"cargo-credential",
|
||||
"security-framework",
|
||||
@ -361,7 +361,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential-wincred"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"cargo-credential",
|
||||
"windows-sys",
|
||||
@ -378,7 +378,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -600,7 +600,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crates-io"
|
||||
version = "0.39.1"
|
||||
version = "0.39.2"
|
||||
dependencies = [
|
||||
"curl",
|
||||
"percent-encoding",
|
||||
@ -1904,7 +1904,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.8"
|
||||
version = "0.5.9"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
17
Cargo.toml
17
Cargo.toml
@ -106,6 +106,20 @@ varisat = "0.2.2"
|
||||
walkdir = "2.4.0"
|
||||
windows-sys = "0.48"
|
||||
|
||||
[workspace.lints.rust]
|
||||
rust_2018_idioms = "warn" # TODO: could this be removed?
|
||||
|
||||
[workspace.lints.rustdoc]
|
||||
private_intra_doc_links = "allow"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
all = { level = "allow", priority = -1 }
|
||||
dbg_macro = "warn"
|
||||
disallowed_methods = "warn"
|
||||
print_stderr = "warn"
|
||||
print_stdout = "warn"
|
||||
self_named_module_files = "warn"
|
||||
|
||||
[package]
|
||||
name = "cargo"
|
||||
version = "0.77.0"
|
||||
@ -234,3 +248,6 @@ vendored-openssl = ["openssl/vendored"]
|
||||
vendored-libgit2 = ["libgit2-sys/vendored"]
|
||||
# This is primarily used by rust-lang/rust distributing cargo the executable.
|
||||
all-static = ['vendored-openssl', 'curl/static-curl', 'curl/force-system-lib-on-osx']
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -32,3 +32,6 @@ harness = false
|
||||
[[bench]]
|
||||
name = "global_cache_tracker"
|
||||
harness = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
use cargo::Config;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
@ -12,3 +12,6 @@ cargo_metadata.workspace = true
|
||||
flate2.workspace = true
|
||||
tar.workspace = true
|
||||
toml.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -4,6 +4,9 @@
|
||||
//! Use the `-f` flag to allow it to overwrite existing captures.
|
||||
//! The workspace will be saved in a `.tgz` file in the `../workspaces` directory.
|
||||
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use flate2::{Compression, GzBuilder};
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version = "1.70.0" # MSRV:3
|
||||
@ -11,3 +11,6 @@ description = "Cargo's representation of a target platform."
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,6 +1,8 @@
|
||||
//! This example demonstrates how to filter a Platform based on the current
|
||||
//! host target.
|
||||
|
||||
#![allow(clippy::print_stdout)]
|
||||
|
||||
use cargo_platform::{Cfg, Platform};
|
||||
use std::process::Command;
|
||||
use std::str::FromStr;
|
||||
|
@ -12,3 +12,6 @@ publish = false
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -33,3 +33,6 @@ walkdir.workspace = true
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { workspace = true, features = ["Win32_Storage_FileSystem"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
fn main() {
|
||||
println!(
|
||||
"cargo:rustc-env=NATIVE_ARCH={}",
|
||||
|
@ -2,7 +2,9 @@
|
||||
//!
|
||||
//! See <https://rust-lang.github.io/cargo/contrib/> for a guide on writing tests.
|
||||
|
||||
#![allow(clippy::all)]
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
#![allow(clippy::print_stdout)]
|
||||
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
|
@ -28,3 +28,6 @@ core-foundation.workspace = true
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
miow.workspace = true
|
||||
windows-sys = { workspace = true, features = ["Win32_Storage_FileSystem", "Win32_Foundation", "Win32_System_Console"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,5 +1,7 @@
|
||||
//! Miscellaneous support code used by Cargo.
|
||||
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
pub use self::read2::read2;
|
||||
pub use du::du;
|
||||
pub use process_builder::ProcessBuilder;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "crates-io"
|
||||
version = "0.39.1"
|
||||
version = "0.39.2"
|
||||
rust-version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
@ -20,3 +20,6 @@ serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
url.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![allow(clippy::all)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "home"
|
||||
version = "0.5.8"
|
||||
version = "0.5.9"
|
||||
authors = ["Brian Anderson <andersrb@gmail.com>"]
|
||||
rust-version = "1.70.0" # MSRV:3
|
||||
documentation = "https://docs.rs/home"
|
||||
@ -18,3 +18,6 @@ description = "Shared definitions of home directories."
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { workspace = true, features = ["Win32_Foundation", "Win32_UI_Shell"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -18,7 +18,7 @@
|
||||
//!
|
||||
//! [discussion]: https://github.com/rust-lang/rust/pull/46799#issuecomment-361156935
|
||||
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
pub mod env;
|
||||
|
||||
|
@ -17,3 +17,6 @@ url.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use anyhow::{bail, format_err, Context, Error};
|
||||
use mdman::{Format, ManMap};
|
||||
use std::collections::HashMap;
|
||||
|
@ -3,6 +3,8 @@
|
||||
//! Use the MDMAN_BLESS environment variable to automatically update the
|
||||
//! expected output.
|
||||
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
use mdman::{Format, ManMap};
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::path::PathBuf;
|
||||
|
@ -10,3 +10,6 @@ cargo.workspace = true
|
||||
cargo-util.workspace = true
|
||||
proptest.workspace = true
|
||||
varisat.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(clippy::all)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::PartialEq;
|
||||
|
@ -10,3 +10,6 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
tempfile.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -13,6 +13,8 @@
|
||||
//! - `dont-deny`: By default tests have a `#![deny(warnings)]`. This option
|
||||
//! avoids this attribute. Note that `#![allow(unused)]` is always added.
|
||||
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use std::error::Error;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
@ -6,3 +6,6 @@ edition.workspace = true
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -10,6 +10,8 @@
|
||||
//! For more, read their doc comments.
|
||||
//! ```
|
||||
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
|
@ -14,3 +14,6 @@ git2.workspace = true
|
||||
semver.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -7,3 +7,6 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
toml_edit.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -10,6 +10,8 @@
|
||||
//! Probably autofix them in the future.
|
||||
//! ```
|
||||
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use std::fmt::Write as _;
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
|
@ -11,3 +11,6 @@ description = "A Cargo credential process that stores tokens in a 1password vaul
|
||||
cargo-credential.workspace = true
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,5 +1,8 @@
|
||||
//! Cargo registry 1password credential process.
|
||||
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
use cargo_credential::{
|
||||
Action, CacheControl, Credential, CredentialResponse, Error, RegistryInfo, Secret,
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cargo-credential-libsecret"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
@ -11,3 +11,6 @@ description = "A Cargo credential process that stores tokens with GNOME libsecre
|
||||
anyhow.workspace = true
|
||||
cargo-credential.workspace = true
|
||||
libloading.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cargo-credential-macos-keychain"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
@ -12,3 +12,6 @@ cargo-credential.workspace = true
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
security-framework.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,5 +1,7 @@
|
||||
//! Cargo registry macos keychain credential process.
|
||||
|
||||
#![allow(clippy::print_stderr)]
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos {
|
||||
use cargo_credential::{
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cargo-credential-wincred"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
@ -13,3 +13,6 @@ cargo-credential.workspace = true
|
||||
[target.'cfg(windows)'.dependencies.windows-sys]
|
||||
features = ["Win32_Foundation", "Win32_Security_Credentials"]
|
||||
workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cargo-credential"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version = "1.70.0" # MSRV:3
|
||||
@ -20,3 +20,6 @@ windows-sys = { workspace = true, features = ["Win32_System_Console", "Win32_Fou
|
||||
|
||||
[dev-dependencies]
|
||||
snapbox = { workspace = true, features = ["examples"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
@ -1,5 +1,8 @@
|
||||
//! Provider used for testing redirection of stdout.
|
||||
|
||||
#![allow(clippy::print_stderr)]
|
||||
#![allow(clippy::print_stdout)]
|
||||
|
||||
use cargo_credential::{Action, Credential, CredentialResponse, Error, RegistryInfo};
|
||||
|
||||
struct MyCredential;
|
||||
|
@ -37,6 +37,9 @@
|
||||
#![doc = include_str!("../examples/file-provider.rs")]
|
||||
//! ```
|
||||
|
||||
#![allow(clippy::print_stderr)]
|
||||
#![allow(clippy::print_stdout)]
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt::Display, io};
|
||||
use time::OffsetDateTime;
|
||||
|
@ -1,6 +1,4 @@
|
||||
#![warn(rust_2018_idioms)] // while we're getting used to 2018
|
||||
#![allow(clippy::all)]
|
||||
#![warn(clippy::disallowed_methods)]
|
||||
#![allow(clippy::self_named_module_files)] // false positive in `commands/build.rs`
|
||||
|
||||
use cargo::util::network::http::http_handle;
|
||||
use cargo::util::network::http::needs_custom_http_transport;
|
||||
|
@ -129,20 +129,6 @@
|
||||
//! [The Cargo Book]: https://doc.rust-lang.org/cargo/
|
||||
//! [Cargo Contributor Guide]: https://doc.crates.io/contrib/
|
||||
|
||||
// TODO: consider removing these lint attributes when `-Zlints` hits stable.
|
||||
// For various reasons, some idioms are still allow'ed, but we would like to
|
||||
// test and enforce them.
|
||||
#![warn(rust_2018_idioms)]
|
||||
// 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)]
|
||||
#![warn(clippy::disallowed_methods)]
|
||||
#![warn(clippy::self_named_module_files)]
|
||||
#![warn(clippy::print_stdout)]
|
||||
#![warn(clippy::print_stderr)]
|
||||
#![warn(clippy::dbg_macro)]
|
||||
#![allow(rustdoc::private_intra_doc_links)]
|
||||
|
||||
use crate::core::shell::Verbosity::Verbose;
|
||||
use crate::core::Shell;
|
||||
use anyhow::Error;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![allow(unknown_lints)]
|
||||
|
||||
use anyhow::Error;
|
||||
use curl::easy::Easy;
|
||||
use std::fmt::{self, Write};
|
||||
|
@ -18,6 +18,8 @@
|
||||
//! `CARGO_RUN_BUILD_STD_TESTS` env var to be set to actually run these tests.
|
||||
//! Otherwise the tests are skipped.
|
||||
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
use cargo_test_support::*;
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// See src/cargo/lib.rs for notes on these lint settings.
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![allow(clippy::all)]
|
||||
#![allow(clippy::disallowed_methods)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
#![allow(clippy::print_stdout)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate cargo_test_macro;
|
||||
|
Loading…
x
Reference in New Issue
Block a user