Skip to content

Commit

Permalink
fix triggering lints
Browse files Browse the repository at this point in the history
  • Loading branch information
wmmc88 committed Apr 3, 2024
1 parent 0ca098e commit 6d91dbe
Show file tree
Hide file tree
Showing 13 changed files with 294 additions and 184 deletions.
348 changes: 178 additions & 170 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ serde_json = "1.0"
#
# [lints]
# workspace = true
#

[workspace.lints.rust]
missing_docs = "warn"
unsafe_op_in_unsafe_fn = "forbid"
Expand Down
2 changes: 2 additions & 0 deletions crates/sample-kmdf-driver/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation
// License: MIT OR Apache-2.0

//! Build script for the `sample-kmdf-driver` crate.
fn main() -> Result<(), wdk_build::ConfigError> {
wdk_build::Config::from_env_auto()?.configure_binary_build()
}
5 changes: 5 additions & 0 deletions crates/sample-kmdf-driver/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Copyright (c) Microsoft Corporation
// License: MIT OR Apache-2.0

//! # Sample KMDF Driver
//!
//! This is a sample KMDF driver that demonstrates how to use the crates in
//! windows-driver-rs to create a skeleton of a kmdf driver.
#![no_std]

extern crate alloc;
Expand Down
36 changes: 34 additions & 2 deletions crates/wdk-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,37 @@ windows = { version = "0.52.0", features = ["Win32_UI_Shell"] }
# // versions is not a concern
#![allow(clippy::multiple_crate_versions)]

[lints]
workspace = true
# Cannot inherit workspace lints since overriding them is not supported yet: https://github.com/rust-lang/cargo/issues/13157
# [lints]
# workspace = true
#
# Differences from the workspace lints have comments explaining why they are different

[lints.rust]
missing_docs = "warn"
unsafe_op_in_unsafe_fn = "forbid"

[lints.clippy]
# Lint Groups
all = "deny"
pedantic = "warn"
nursery = "warn"
cargo = "warn"
# Individual Lints
# multiple_unsafe_ops_per_block = "forbid"
multiple_unsafe_ops_per_block = "deny" # This is lowered to deny since clap generates allow(clippy::restriction) in its Parser and Args derive macros
# undocumented_unsafe_blocks = "forbid"
undocumented_unsafe_blocks = "deny" # This is lowered to deny since clap generates allow(clippy::restriction) in its Parser and Args derive macros
# unnecessary_safety_doc = "forbid"
unnecessary_safety_doc = "deny" # This is lowered to deny since clap generates allow(clippy::restriction) in its Parser and Args derive macros

[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"
2 changes: 2 additions & 0 deletions crates/wdk-build/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation
// License: MIT OR Apache-2.0

//! Build script for the `wdk-build` crate.
#[rustversion::nightly]
fn main() {
println!("cargo:rustc-cfg=nightly_toolchain");
Expand Down
34 changes: 32 additions & 2 deletions crates/wdk-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,35 @@ development = [
default = []
nightly = []

[lints]
workspace = true
# Cannot inherit workspace lints since overriding them is not supported yet: https://github.com/rust-lang/cargo/issues/13157
# [lints]
# workspace = true
#
# Differences from the workspace lints have comments explaining why they are different

[lints.rust]
missing_docs = "warn"
unsafe_op_in_unsafe_fn = "forbid"

[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"
unnecessary_safety_doc = "deny" # This is lowered to deny to allow overriding it for proc_macros: https://github.com/rust-lang/rust-clippy/issues/12583

[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"
3 changes: 2 additions & 1 deletion crates/wdk-macros/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ lazy_static! {
static ref MACROTEST_INPUT_FOLDER_PATH: PathBuf = INPUTS_FOLDER_PATH.join("macrotest");
static ref TRYBUILD_INPUT_FOLDER_PATH: PathBuf = INPUTS_FOLDER_PATH.join("trybuild");
static ref OUTPUTS_FOLDER_PATH: PathBuf = TESTS_FOLDER_PATH.join("outputs");
static ref TOOLCHAIN_SPECIFIC_OUTPUTS_FOLDER_PATH: PathBuf = OUTPUTS_FOLDER_PATH.join(TOOLCHAIN_CHANNEL_NAME);
static ref TOOLCHAIN_SPECIFIC_OUTPUTS_FOLDER_PATH: PathBuf =
OUTPUTS_FOLDER_PATH.join(TOOLCHAIN_CHANNEL_NAME);
static ref MACROTEST_OUTPUT_FOLDER_PATH: PathBuf =
TOOLCHAIN_SPECIFIC_OUTPUTS_FOLDER_PATH.join("macrotest");
static ref TRYBUILD_OUTPUT_FOLDER_PATH: PathBuf =
Expand Down
36 changes: 34 additions & 2 deletions crates/wdk-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,37 @@ default = []
nightly = ["wdk-macros/nightly"]
test-stubs = []

[lints]
workspace = true
# Cannot inherit workspace lints since overriding them is not supported yet: https://github.com/rust-lang/cargo/issues/13157
# [lints]
# workspace = true
#
# Differences from the workspace lints have comments explaining why they are different

[lints.rust]
missing_docs = "warn"
# unsafe_op_in_unsafe_fn = "forbid"
unsafe_op_in_unsafe_fn = "deny" # This is lowered to deny so that we can opt out of it for generated code

[lints.clippy]
# Lint Groups
all = "deny"
pedantic = "warn"
nursery = "warn"
cargo = "warn"
# Individual Lints
# multiple_unsafe_ops_per_block = "forbid"
multiple_unsafe_ops_per_block = "deny" # This is lowered to deny so that we can opt out of it for generated code
# undocumented_unsafe_blocks = "forbid"
undocumented_unsafe_blocks = "deny" # This is lowered to deny so that we can opt out of it for generated code
unnecessary_safety_doc = "forbid"

[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"
2 changes: 2 additions & 0 deletions crates/wdk-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation
// License: MIT OR Apache-2.0

//! Build script for the `wdk-sys` crate.
use std::{
env,
path::{Path, PathBuf},
Expand Down
2 changes: 2 additions & 0 deletions crates/wdk/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation
// License: MIT OR Apache-2.0

//! Build script for the `wdk` crate.
fn main() -> Result<(), wdk_build::ConfigError> {
// Re-export config from wdk-sys
Ok(wdk_build::Config::from_env_auto()?.export_config()?)
Expand Down
3 changes: 0 additions & 3 deletions crates/wdk/src/wdf/spinlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ use wdk_sys::{macros, NTSTATUS, WDFSPINLOCK, WDF_OBJECT_ATTRIBUTES};

use crate::nt_success;

// private module + public re-export avoids the module name repetition: https://github.com/rust-lang/rust-clippy/issues/8524
#[allow(clippy::module_name_repetitions)]

/// WDF Spin Lock.
///
/// Use framework spin locks to synchronize access to driver data from code that
Expand Down
3 changes: 0 additions & 3 deletions crates/wdk/src/wdf/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ use wdk_sys::{macros, NTSTATUS, WDFTIMER, WDF_OBJECT_ATTRIBUTES, WDF_TIMER_CONFI

use crate::nt_success;

// private module + public re-export avoids the module name repetition: https://github.com/rust-lang/rust-clippy/issues/8524
#[allow(clippy::module_name_repetitions)]

/// WDF Timer.
pub struct Timer {
wdf_timer: WDFTIMER,
Expand Down

0 comments on commit 6d91dbe

Please sign in to comment.