From ec9ec6d9a5db7f7c075a5a2ecb7eec10afa01725 Mon Sep 17 00:00:00 2001 From: David Skrundz Date: Sat, 20 Sep 2025 20:31:22 -0600 Subject: [PATCH] Lints and build commands --- Cargo.toml | 2 ++ README.md | 15 +++++++++++++++ rust/Cargo.toml | 4 ++++ rust/src/lib.rs | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d27bbba..a6209aa 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 76a6cd4..0c50286 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ # Workspace Template Make sure not to keep git history when copying this template + +## Various builds + +- 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` +- example: `cargo run --example= --features=` +- fmt: `cargo fmt --check` +- docs: `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features` +- install: `cargo install --path ` +- semver: `cargo semver-checks --all-features` +- publish: `cargo publish --dry-run -p ` +- publish: `cargo publish --dry-run --workspace` diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 08397b7..617860d 100644 --- a/rust/Cargo.toml +++ b/rust/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] workspace = true diff --git a/rust/src/lib.rs b/rust/src/lib.rs index d548138..c099411 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,3 +1,9 @@ +//! Module + +#![cfg_attr(docsrs, feature(doc_cfg))] +// #[cfg_attr(docsrs, doc(cfg(feature = "std")))] + +/// Add function pub fn add(left: usize, right: usize) -> usize { left.wrapping_add(right) }