From 0c437d816a4cc29acf949b9c19cc9612378fa884 Mon Sep 17 00:00:00 2001 From: David Skrundz Date: Sat, 20 Sep 2025 20:35:18 -0600 Subject: [PATCH] Lints and build commands --- Cargo.toml | 2 ++ README.md | 4 ++++ architect/Cargo.toml | 4 ++++ architect/src/input/mod.rs | 2 ++ architect/src/lib.rs | 4 ++++ architect/src/output/mod.rs | 2 ++ architect/src/output/raw.rs | 13 ++++++++----- sample/Cargo.toml | 4 ++++ 8 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3261a8a..d1236d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,9 @@ rust-version = "1.85.0" [workspace.lints.rust] arithmetic_overflow = "forbid" +missing_docs = "forbid" unsafe_code = "forbid" +unused_doc_comments = "forbid" [workspace.lints.clippy] arithmetic_side_effects = "forbid" diff --git a/README.md b/README.md index ccd5d0b..28eee07 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ A library for build scripts to interface with cargo. It is intended that you add - build: `cargo hack --feature-powerset build` - clippy: `cargo hack --feature-powerset clippy -- -D warnings` +- test: `cargo hack --feature-powerset test` +- test old: `cargo +1.85 hack --feature-powerset test` +- miri: `cargo +nightly hack --feature-powerset miri test` - fmt: `cargo fmt --check` - docs: `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features` +- semver: `cargo semver-checks --all-features` - publish: `cargo publish --dry-run -p architect` diff --git a/architect/Cargo.toml b/architect/Cargo.toml index 567c3f0..d00ece2 100644 --- a/architect/Cargo.toml +++ b/architect/Cargo.toml @@ -11,6 +11,10 @@ edition.workspace = true license-file.workspace = true rust-version.workspace = true +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [lints] workspace = true diff --git a/architect/src/input/mod.rs b/architect/src/input/mod.rs index f8d2aac..19db1c5 100644 --- a/architect/src/input/mod.rs +++ b/architect/src/input/mod.rs @@ -1,2 +1,4 @@ +//! Everything relating to getting inputs + /// Raw access for any missing APIs, these may be deleted at any time. pub mod raw; diff --git a/architect/src/lib.rs b/architect/src/lib.rs index 7d1a548..228aeb6 100644 --- a/architect/src/lib.rs +++ b/architect/src/lib.rs @@ -1,2 +1,6 @@ +//! Cargo interface for build scripts + +#![cfg_attr(docsrs, feature(doc_cfg))] + pub mod input; pub mod output; diff --git a/architect/src/output/mod.rs b/architect/src/output/mod.rs index f8d2aac..21db812 100644 --- a/architect/src/output/mod.rs +++ b/architect/src/output/mod.rs @@ -1,2 +1,4 @@ +//! Everything relating to writing outputs + /// Raw access for any missing APIs, these may be deleted at any time. pub mod raw; diff --git a/architect/src/output/raw.rs b/architect/src/output/raw.rs index 12eae86..b8ee356 100644 --- a/architect/src/output/raw.rs +++ b/architect/src/output/raw.rs @@ -169,11 +169,14 @@ pub fn rustc_cfg(key: &str, value: Option<&str>) { /// /// The instruction can be used like this: /// -/// // build.rs -/// println!("cargo::rustc-check-cfg=cfg(foo, values(\"bar\"))"); -/// if foo_bar_condition { -/// println!("cargo::rustc-cfg=foo=\"bar\""); -/// } +/// ```no_run +/// # let foo_bar_condition = false; +/// // build.rs +/// println!("cargo::rustc-check-cfg=cfg(foo, values(\"bar\"))"); +/// if foo_bar_condition { +/// println!("cargo::rustc-cfg=foo=\"bar\""); +/// } +/// ``` /// /// Note that all possible cfgs should be defined, regardless of which cfgs are /// currently enabled. This includes all possible values of a given cfg name. diff --git a/sample/Cargo.toml b/sample/Cargo.toml index 381d5ef..f7ec551 100644 --- a/sample/Cargo.toml +++ b/sample/Cargo.toml @@ -7,6 +7,10 @@ edition.workspace = true license-file.workspace = true rust-version.workspace = true +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [lints.rust] arithmetic_overflow = "forbid" unsafe_code = "forbid"