lint: dogfood ourselves lints table in manifest

These lint rules are from src/lib.rs. We aim to remove
them in the source code once `Zlints` hit stable.
This commit is contained in:
Weihang Lo 2023-05-24 22:25:07 +01:00
parent 80326ca1f4
commit 1539b3dfc1
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
28 changed files with 74 additions and 32 deletions

View File

@ -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

View File

@ -32,3 +32,6 @@ harness = false
[[bench]]
name = "global_cache_tracker"
harness = false
[lints]
workspace = true

View File

@ -12,3 +12,6 @@ cargo_metadata.workspace = true
flate2.workspace = true
tar.workspace = true
toml.workspace = true
[lints]
workspace = true

View File

@ -11,3 +11,6 @@ description = "Cargo's representation of a target platform."
[dependencies]
serde.workspace = true
[lints]
workspace = true

View File

@ -12,3 +12,6 @@ publish = false
[lib]
proc-macro = true
[lints]
workspace = true

View File

@ -33,3 +33,6 @@ walkdir.workspace = true
[target.'cfg(windows)'.dependencies]
windows-sys = { workspace = true, features = ["Win32_Storage_FileSystem"] }
[lints]
workspace = true

View File

@ -2,8 +2,6 @@
//!
//! See <https://rust-lang.github.io/cargo/contrib/> for a guide on writing tests.
#![allow(clippy::all)]
use std::env;
use std::ffi::OsStr;
use std::fmt::Write;

View File

@ -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

View File

@ -20,3 +20,6 @@ serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
url.workspace = true
[lints]
workspace = true

View File

@ -1,5 +1,3 @@
#![allow(clippy::all)]
use std::collections::BTreeMap;
use std::fs::File;
use std::io::prelude::*;

View File

@ -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

View File

@ -18,8 +18,6 @@
//!
//! [discussion]: https://github.com/rust-lang/rust/pull/46799#issuecomment-361156935
#![deny(rust_2018_idioms)]
pub mod env;
#[cfg(target_os = "windows")]

View File

@ -17,3 +17,6 @@ url.workspace = true
[dev-dependencies]
pretty_assertions.workspace = true
[lints]
workspace = true

View File

@ -10,3 +10,6 @@ cargo.workspace = true
cargo-util.workspace = true
proptest.workspace = true
varisat.workspace = true
[lints]
workspace = true

View File

@ -1,5 +1,3 @@
#![allow(clippy::all)]
use std::cell::RefCell;
use std::cmp::PartialEq;
use std::cmp::{max, min};

View File

@ -10,3 +10,6 @@ publish = false
[dependencies]
tempfile.workspace = true
[lints]
workspace = true

View File

@ -6,3 +6,6 @@ edition.workspace = true
publish = false
[dependencies]
[lints]
workspace = true

View File

@ -14,3 +14,6 @@ git2.workspace = true
semver.workspace = true
tracing-subscriber.workspace = true
tracing.workspace = true
[lints]
workspace = true

View File

@ -7,3 +7,6 @@ publish = false
[dependencies]
toml_edit.workspace = true
[lints]
workspace = true

View File

@ -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

View File

@ -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

View File

@ -12,3 +12,6 @@ cargo-credential.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
security-framework.workspace = true
[lints]
workspace = true

View File

@ -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

View File

@ -20,3 +20,6 @@ windows-sys = { workspace = true, features = ["Win32_System_Console", "Win32_Fou
[dev-dependencies]
snapbox = { workspace = true, features = ["examples"] }
[lints]
workspace = true

View File

@ -1,7 +1,3 @@
#![warn(rust_2018_idioms)] // while we're getting used to 2018
#![allow(clippy::all)]
#![warn(clippy::disallowed_methods)]
use cargo::util::network::http::http_handle;
use cargo::util::network::http::needs_custom_http_transport;
use cargo::util::toml::schema::StringOrVec;

View File

@ -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;

View File

@ -1,5 +1,3 @@
#![allow(unknown_lints)]
use anyhow::Error;
use curl::easy::Easy;
use std::fmt::{self, Write};

View File

@ -1,7 +1,3 @@
// See src/cargo/lib.rs for notes on these lint settings.
#![warn(rust_2018_idioms)]
#![allow(clippy::all)]
#[macro_use]
extern crate cargo_test_macro;