mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
chore: use [lints] to address unexpected_cfgs lint (#7124)
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ freebsd_instance:
|
|||||||
image_family: freebsd-14-1
|
image_family: freebsd-14-1
|
||||||
env:
|
env:
|
||||||
RUST_STABLE: stable
|
RUST_STABLE: stable
|
||||||
RUST_NIGHTLY: nightly-2024-05-05
|
RUST_NIGHTLY: nightly-2025-01-25
|
||||||
RUSTFLAGS: -D warnings
|
RUSTFLAGS: -D warnings
|
||||||
|
|
||||||
# Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the
|
# Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ env:
|
|||||||
RUSTUP_WINDOWS_PATH_ADD_BIN: 1
|
RUSTUP_WINDOWS_PATH_ADD_BIN: 1
|
||||||
# Change to specific Rust release to pin
|
# Change to specific Rust release to pin
|
||||||
rust_stable: stable
|
rust_stable: stable
|
||||||
rust_nightly: nightly-2024-05-05
|
rust_nightly: nightly-2025-01-25
|
||||||
# Pin a specific miri version
|
# Pin a specific miri version
|
||||||
rust_miri_nightly: nightly-2024-10-21
|
rust_miri_nightly: nightly-2025-01-25
|
||||||
rust_clippy: '1.77'
|
rust_clippy: '1.77'
|
||||||
# When updating this, also update:
|
# When updating this, also update:
|
||||||
# - README.md
|
# - README.md
|
||||||
@@ -1086,23 +1086,6 @@ jobs:
|
|||||||
run: cargo check-external-types --all-features
|
run: cargo check-external-types --all-features
|
||||||
working-directory: tokio
|
working-directory: tokio
|
||||||
|
|
||||||
check-unexpected-lints-cfgs:
|
|
||||||
name: check unexpected lints and cfgs
|
|
||||||
needs: basics
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install Rust ${{ env.rust_nightly }}
|
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
toolchain: ${{ env.rust_nightly }}
|
|
||||||
- name: don't allow warnings
|
|
||||||
run: sed -i '/#!\[allow(unknown_lints, unexpected_cfgs)\]/d' */src/lib.rs */tests/*.rs
|
|
||||||
- name: check for unknown lints and cfgs
|
|
||||||
run: cargo check --all-features --tests
|
|
||||||
env:
|
|
||||||
RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom,tokio_unstable,tokio_taskdump,fuzzing,mio_unsupported_force_poll_poll,tokio_internal_mt_counters,fs,tokio_no_parking_lot,tokio_no_tuning_tests) -Funexpected_cfgs -Funknown_lints
|
|
||||||
|
|
||||||
check-fuzzing:
|
check-fuzzing:
|
||||||
name: check-fuzzing
|
name: check-fuzzing
|
||||||
needs: basics
|
needs: basics
|
||||||
|
|||||||
+12
@@ -17,3 +17,15 @@ members = [
|
|||||||
|
|
||||||
[workspace.metadata.spellcheck]
|
[workspace.metadata.spellcheck]
|
||||||
config = "spellcheck.toml"
|
config = "spellcheck.toml"
|
||||||
|
|
||||||
|
[workspace.lints.rust]
|
||||||
|
unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
|
'cfg(fuzzing)',
|
||||||
|
'cfg(loom)',
|
||||||
|
'cfg(mio_unsupported_force_poll_poll)',
|
||||||
|
'cfg(tokio_internal_mt_counters)',
|
||||||
|
'cfg(tokio_no_parking_lot)',
|
||||||
|
'cfg(tokio_no_tuning_tests)',
|
||||||
|
'cfg(tokio_taskdump)',
|
||||||
|
'cfg(tokio_unstable)',
|
||||||
|
] }
|
||||||
|
|||||||
@@ -95,3 +95,6 @@ harness = false
|
|||||||
name = "time_timeout"
|
name = "time_timeout"
|
||||||
path = "time_timeout.rs"
|
path = "time_timeout.rs"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -95,3 +95,6 @@ path = "named-pipe-multi-client.rs"
|
|||||||
[[example]]
|
[[example]]
|
||||||
name = "dump"
|
name = "dump"
|
||||||
path = "dump.rs"
|
path = "dump.rs"
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
|
|
||||||
//! This example demonstrates tokio's experimental task dumping functionality.
|
//! This example demonstrates tokio's experimental task dumping functionality.
|
||||||
//! This application deadlocks. Input CTRL+C to display traces of each task, or
|
//! This application deadlocks. Input CTRL+C to display traces of each task, or
|
||||||
//! input CTRL+C twice within 1 second to quit.
|
//! input CTRL+C twice within 1 second to quit.
|
||||||
|
|||||||
@@ -13,3 +13,6 @@ tokio = { version = "1.0.0", path = "../tokio/", features = ["full"] }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -15,3 +15,6 @@ tokio = { version = "1.0.0", path = "../tokio", optional = true }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
trybuild = "1.0"
|
trybuild = "1.0"
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -61,3 +61,6 @@ tokio-test = { version = "0.4", path = "../tokio-test", optional = true }
|
|||||||
doc-comment = "0.3.1"
|
doc-comment = "0.3.1"
|
||||||
futures = { version = "0.3.0", features = ["async-await"] }
|
futures = { version = "0.3.0", features = ["async-await"] }
|
||||||
bytes = "1.0.0"
|
bytes = "1.0.0"
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -31,3 +31,6 @@ tokio = { version = "1.0.0", path = "../tokio", features = ["full"] }
|
|||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![allow(clippy::needless_doctest_main)]
|
#![allow(clippy::needless_doctest_main)]
|
||||||
#![warn(
|
#![warn(
|
||||||
missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
@@ -211,7 +210,6 @@ use proc_macro::TokenStream;
|
|||||||
/// This option is only compatible with the `current_thread` runtime.
|
/// This option is only compatible with the `current_thread` runtime.
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # #![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
/// #[cfg(tokio_unstable)]
|
/// #[cfg(tokio_unstable)]
|
||||||
/// #[tokio::main(flavor = "current_thread", unhandled_panic = "shutdown_runtime")]
|
/// #[tokio::main(flavor = "current_thread", unhandled_panic = "shutdown_runtime")]
|
||||||
/// async fn main() {
|
/// async fn main() {
|
||||||
@@ -226,7 +224,6 @@ use proc_macro::TokenStream;
|
|||||||
/// Equivalent code not using `#[tokio::main]`
|
/// Equivalent code not using `#[tokio::main]`
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # #![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
/// #[cfg(tokio_unstable)]
|
/// #[cfg(tokio_unstable)]
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// tokio::runtime::Builder::new_current_thread()
|
/// tokio::runtime::Builder::new_current_thread()
|
||||||
@@ -480,7 +477,6 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
/// This option is only compatible with the `current_thread` runtime.
|
/// This option is only compatible with the `current_thread` runtime.
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # #![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
/// #[cfg(tokio_unstable)]
|
/// #[cfg(tokio_unstable)]
|
||||||
/// #[tokio::test(flavor = "current_thread", unhandled_panic = "shutdown_runtime")]
|
/// #[tokio::test(flavor = "current_thread", unhandled_panic = "shutdown_runtime")]
|
||||||
/// async fn my_test() {
|
/// async fn my_test() {
|
||||||
@@ -495,7 +491,6 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
/// Equivalent code not using `#[tokio::test]`
|
/// Equivalent code not using `#[tokio::test]`
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # #![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
/// #[cfg(tokio_unstable)]
|
/// #[cfg(tokio_unstable)]
|
||||||
/// #[test]
|
/// #[test]
|
||||||
/// fn my_test() {
|
/// fn my_test() {
|
||||||
|
|||||||
@@ -56,3 +56,6 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||||||
# This should allow `docsrs` to be read across projects, so that `tokio-stream`
|
# This should allow `docsrs` to be read across projects, so that `tokio-stream`
|
||||||
# can pick up stubbed types exported by `tokio`.
|
# can pick up stubbed types exported by `tokio`.
|
||||||
rustc-args = ["--cfg", "docsrs"]
|
rustc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::cognitive_complexity,
|
clippy::cognitive_complexity,
|
||||||
clippy::large_enum_variant,
|
clippy::large_enum_variant,
|
||||||
|
|||||||
@@ -30,3 +30,6 @@ futures-util = "0.3.0"
|
|||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(
|
#![warn(
|
||||||
missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
missing_docs,
|
missing_docs,
|
||||||
|
|||||||
@@ -68,3 +68,6 @@ rustc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable"]
|
|||||||
|
|
||||||
[package.metadata.playground]
|
[package.metadata.playground]
|
||||||
features = ["full"]
|
features = ["full"]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![allow(clippy::needless_doctest_main)]
|
#![allow(clippy::needless_doctest_main)]
|
||||||
#![warn(
|
#![warn(
|
||||||
missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "rt", tokio_unstable))]
|
#![cfg(all(feature = "rt", tokio_unstable))]
|
||||||
|
|
||||||
|
|||||||
@@ -173,3 +173,6 @@ allowed_external_types = [
|
|||||||
"bytes::buf::buf_mut::BufMut",
|
"bytes::buf::buf_mut::BufMut",
|
||||||
"tokio_macros::*",
|
"tokio_macros::*",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::cognitive_complexity,
|
clippy::cognitive_complexity,
|
||||||
clippy::large_enum_variant,
|
clippy::large_enum_variant,
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ pub(crate) struct Task {
|
|||||||
|
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub(crate) enum Mandatory {
|
pub(crate) enum Mandatory {
|
||||||
#[cfg_attr(not(fs), allow(dead_code))]
|
#[cfg_attr(not(feature = "fs"), allow(dead_code))]
|
||||||
Mandatory,
|
Mandatory,
|
||||||
NonMandatory,
|
NonMandatory,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
|
|
||||||
#[cfg(not(any(feature = "full", target_family = "wasm")))]
|
#[cfg(not(any(feature = "full", target_family = "wasm")))]
|
||||||
compile_error!("run main Tokio tests with `--features full`");
|
compile_error!("run main Tokio tests with `--features full`");
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![cfg(all(
|
#![cfg(all(
|
||||||
tokio_unstable,
|
tokio_unstable,
|
||||||
tokio_taskdump,
|
tokio_taskdump,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![cfg(feature = "macros")]
|
#![cfg(feature = "macros")]
|
||||||
#![allow(clippy::disallowed_names)]
|
#![allow(clippy::disallowed_names)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
|
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
|
||||||
|
|
||||||
use tokio::test;
|
use tokio::test;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(not(miri))] // Possible bug on Miri.
|
#![cfg(not(miri))] // Possible bug on Miri.
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![allow(clippy::needless_range_loop)]
|
#![allow(clippy::needless_range_loop)]
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", tokio_unstable))]
|
#![cfg(all(feature = "full", tokio_unstable))]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi"), target_has_atomic = "64"))]
|
#![cfg(all(feature = "full", not(target_os = "wasi"), target_has_atomic = "64"))]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
// Too slow on miri.
|
// Too slow on miri.
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))]
|
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi")))]
|
#![cfg(all(feature = "full", not(target_os = "wasi")))]
|
||||||
#![cfg(tokio_unstable)]
|
#![cfg(tokio_unstable)]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(
|
#![cfg(all(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![cfg(all(tokio_unstable, feature = "tracing"))]
|
#![cfg(all(tokio_unstable, feature = "tracing"))]
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", tokio_unstable, target_has_atomic = "64"))]
|
#![cfg(all(feature = "full", tokio_unstable, target_has_atomic = "64"))]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi"), tokio_unstable))]
|
#![cfg(all(feature = "full", not(target_os = "wasi"), tokio_unstable))]
|
||||||
|
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
//!
|
//!
|
||||||
//! These tests ensure that the instrumentation for tokio
|
//! These tests ensure that the instrumentation for tokio
|
||||||
//! synchronization primitives is correct.
|
//! synchronization primitives is correct.
|
||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
|
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
//!
|
//!
|
||||||
//! These tests ensure that the instrumentation for task spawning and task
|
//! These tests ensure that the instrumentation for task spawning and task
|
||||||
//! lifecycles is correct.
|
//! lifecycles is correct.
|
||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
|
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
//!
|
//!
|
||||||
//! These tests ensure that the instrumentation for tokio
|
//! These tests ensure that the instrumentation for tokio
|
||||||
//! synchronization primitives is correct.
|
//! synchronization primitives is correct.
|
||||||
#![allow(unknown_lints, unexpected_cfgs)]
|
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
|
#![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user