Skip to content

Commit

Permalink
refactor: use a standardized workspace lint table
Browse files Browse the repository at this point in the history
  • Loading branch information
wmmc88 committed Mar 29, 2024
1 parent 92db419 commit 933019c
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 119 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

name: Docs

env:
RUSTDOCFLAGS: -D warnings

jobs:
docs:
name: Docs
Expand Down
32 changes: 32 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,35 @@ wdk-sys = { path = "crates/wdk-sys", version = "0.2.0" }
bindgen = "0.69.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# Until https://github.com/rust-lang/cargo/issues/12208 is resolved, each package in the workspace needs to explictly
# add the following block to its Cargo manifest in order to enable these global lint configurations:
#
# [lints]
# workspace = true
#
[workspace.lints.rust]
missing_docs = "warn"
unsafe_op_in_unsafe_fn = "forbid"

[workspace.lints.clippy]
# Lint Groups
all = "deny"
pedantic = "warn"
nursery = "warn"
cargo = "warn"
# Individual Lints
multiple_unsafe_ops_per_block = "forbid"
undocumented_unsafe_blocks = "forbid"
unnecessary_safety_doc = "forbid"

[workspace.lints.rustdoc]
bare_urls = "warn"
broken_intra_doc_links = "warn"
invalid_codeblock_attributes = "warn"
invalid_html_tags = "warn"
invalid_rust_codeblocks = "warn"
missing_crate_level_docs = "warn"
private_intra_doc_links = "warn"
redundant_explicit_links = "warn"
unescaped_backticks = "warn"
1 change: 1 addition & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CARGO_MAKE_SKIP_SLOW_SECONDARY_FLOWS = false
CARGO_MAKE_CLIPPY_ARGS = "--all-targets -- -D warnings"
RUSTFLAGS = "-D warnings"
ORIGINAL_CARGO_MAKE_RUST_DEFAULT_TOOLCHAIN = "${CARGO_MAKE_RUST_DEFAULT_TOOLCHAIN}"
RUSTDOCFLAGS = "-D warnings"

[tasks.wdk-pre-commit-flow]
description = "Run pre-commit tasks and checks"
Expand Down
3 changes: 3 additions & 0 deletions crates/sample-kmdf-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ wdk-build.workspace = true
[features]
default = []
nightly = ["wdk-macros/nightly", "wdk/nightly", "wdk-sys/nightly"]

[lints]
workspace = true
8 changes: 0 additions & 8 deletions crates/sample-kmdf-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
// License: MIT OR Apache-2.0

#![no_std]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(clippy::multiple_unsafe_ops_per_block)]

extern crate alloc;

Expand Down
3 changes: 3 additions & 0 deletions crates/wdk-alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ wdk-sys.workspace = true

[dev-dependencies]
wdk-sys = { workspace = true, features = ["test-stubs"] }

[lints]
workspace = true
18 changes: 0 additions & 18 deletions crates/wdk-alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@
//! ```
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
#![deny(clippy::multiple_unsafe_ops_per_block)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
#![deny(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)]
#![deny(rustdoc::bare_urls)]
#![deny(rustdoc::unescaped_backticks)]
#![deny(rustdoc::redundant_explicit_links)]

use core::alloc::{GlobalAlloc, Layout};

Expand Down
7 changes: 7 additions & 0 deletions crates/wdk-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ rustversion = "1.0.14"

[dev-dependencies]
windows = { version = "0.52.0", features = ["Win32_UI_Shell"] }

# // `wdk-build` is only to be used in build scripts, so binary bloat from multiple dependency
# // versions is not a concern
#![allow(clippy::multiple_crate_versions)]

[lints]
workspace = true
22 changes: 1 addition & 21 deletions crates/wdk-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,8 @@
//! well strives to allow for all the configuration the WDK allows. This
//! includes being ables to select different WDF versions and different driver
//! models (WDM, KMDF, UMDF).
#![cfg_attr(nightly_toolchain, feature(assert_matches))]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
// `wdk-build` is only to be used in build scripts, so binary bloat from multiple depenedency
// versions is not a concern
#![allow(clippy::multiple_crate_versions)]
#![deny(clippy::multiple_unsafe_ops_per_block)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
#![deny(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)]
#![deny(rustdoc::bare_urls)]
#![deny(rustdoc::unescaped_backticks)]
#![deny(rustdoc::redundant_explicit_links)]

mod bindgen;
mod utils;
Expand Down
3 changes: 3 additions & 0 deletions crates/wdk-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ development = [
[features]
default = []
nightly = []

[lints]
workspace = true
18 changes: 0 additions & 18 deletions crates/wdk-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@

//! A collection of macros that help make it easier to interact with
//! [`wdk-sys`]'s direct bindings to the Windows Driver Kit (WDK).
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
#![deny(clippy::multiple_unsafe_ops_per_block)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
#![deny(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)]
#![deny(rustdoc::bare_urls)]
#![deny(rustdoc::unescaped_backticks)]
#![deny(rustdoc::redundant_explicit_links)]
use std::{
io::{BufReader, Read},
Expand Down
3 changes: 3 additions & 0 deletions crates/wdk-panic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ readme.workspace = true
license.workspace = true
keywords = ["panic-handler", "panic", "panic-impl", "wdk", "windows"]
categories = ["no-std", "hardware-support"]

[lints]
workspace = true
19 changes: 1 addition & 18 deletions crates/wdk-panic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,8 @@
// License: MIT OR Apache-2.0

//! Default Panic Handlers for programs built with the WDK (Windows Drivers Kit)
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
#![deny(clippy::multiple_unsafe_ops_per_block)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
#![deny(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)]
#![deny(rustdoc::bare_urls)]
#![deny(rustdoc::unescaped_backticks)]
#![deny(rustdoc::redundant_explicit_links)]

#[cfg(not(test))]
use core::panic::PanicInfo;
Expand Down
3 changes: 3 additions & 0 deletions crates/wdk-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ rustversion = "1.0.14"
default = []
nightly = ["wdk-macros/nightly"]
test-stubs = []

[lints]
workspace = true
18 changes: 0 additions & 18 deletions crates/wdk-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@
//! Direct bindings to APIs available in the Windows Development Kit (WDK)
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
#![deny(clippy::multiple_unsafe_ops_per_block)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
#![deny(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)]
#![deny(rustdoc::bare_urls)]
#![deny(rustdoc::unescaped_backticks)]
#![deny(rustdoc::redundant_explicit_links)]

mod constants;
mod types;
Expand Down
3 changes: 3 additions & 0 deletions crates/wdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ wdk-sys = { workspace = true, features = ["test-stubs"] }
default = ["alloc"]
alloc = []
nightly = ["wdk-sys/nightly"]

[lints]
workspace = true
19 changes: 1 addition & 18 deletions crates/wdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,8 @@
//! Idiomatic Rust wrappers for the Windows Driver Kit (WDK) APIs. This crate is
//! built on top of the raw FFI bindings provided by [`wdk-sys`], and provides a
//! safe, idiomatic rust interface to the WDK.
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![deny(clippy::nursery)]
#![deny(clippy::cargo)]
#![deny(clippy::multiple_unsafe_ops_per_block)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::unnecessary_safety_doc)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
#![deny(rustdoc::missing_crate_level_docs)]
#![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustdoc::invalid_html_tags)]
#![deny(rustdoc::invalid_rust_codeblocks)]
#![deny(rustdoc::bare_urls)]
#![deny(rustdoc::unescaped_backticks)]
#![deny(rustdoc::redundant_explicit_links)]

#[cfg(feature = "alloc")]
mod print;
Expand Down

0 comments on commit 933019c

Please sign in to comment.