diff --git a/crates/auth-sdk/src/lib.rs b/crates/auth-sdk/src/lib.rs index fb9c3c891..bd5ad1418 100644 --- a/crates/auth-sdk/src/lib.rs +++ b/crates/auth-sdk/src/lib.rs @@ -111,6 +111,8 @@ //! tested against the shared vectors in `tests/sdk-vectors`. // docs.rs labels feature-gated items with the features they need. #![cfg_attr(docsrs, feature(doc_cfg))] +// A library leaves printing to its caller: it returns errors and logs through tracing. +#![warn(clippy::print_stdout, clippy::print_stderr)] // Documented by its own inner docs, so their links resolve inside the module. #[cfg(feature = "axum")] diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index d0808b0c2..529c7e60e 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -16,6 +16,8 @@ //! - `sqlx`: decoding identifiers and vocabularies from `PostgreSQL` columns. // docs.rs labels feature-gated items with the features they need. #![cfg_attr(docsrs, feature(doc_cfg))] +// A library leaves printing to its caller: it returns errors and logs through tracing. +#![warn(clippy::print_stdout, clippy::print_stderr)] /// Implements the conversions a text type's `#[serde(try_from = "String", into = /// "String")]` names: it reads owned text through its `FromStr`, and writes what its diff --git a/crates/crypto/src/lib.rs b/crates/crypto/src/lib.rs index a00607eb0..2d0e5fdfd 100644 --- a/crates/crypto/src/lib.rs +++ b/crates/crypto/src/lib.rs @@ -2,6 +2,8 @@ //! Rust SDK; no browser or database policy. // docs.rs labels feature-gated items with the features they need. #![cfg_attr(docsrs, feature(doc_cfg))] +// A library leaves printing to its caller: it returns errors and logs through tracing. +#![warn(clippy::print_stdout, clippy::print_stderr)] /// The one RS256 verifier auth and the SDK share, and compact JWS splitting. mod jws; /// Ed25519 signed notes, for audit checkpoints. diff --git a/crates/database/src/lib.rs b/crates/database/src/lib.rs index ecdc3e01f..7af313c4d 100644 --- a/crates/database/src/lib.rs +++ b/crates/database/src/lib.rs @@ -4,6 +4,8 @@ //! `SQLx` error. Repositories expose only the operations used by the service, plus //! read-only helpers and fixtures behind the `test-util` feature for other //! crates' tests. +// A library leaves printing to its caller: it returns errors and logs through tracing. +#![warn(clippy::print_stdout, clippy::print_stderr)] /// Validated `PostgreSQL` transport and bounded connection pools. mod connection; /// Typed persistence and connection failures. diff --git a/crates/telemetry/src/lib.rs b/crates/telemetry/src/lib.rs index 95ee59da1..81983c449 100644 --- a/crates/telemetry/src/lib.rs +++ b/crates/telemetry/src/lib.rs @@ -16,6 +16,8 @@ //! //! Everything a span, log line or label holds may be exported. Never record a //! secret, a request path or query string, or a request header. +// A library leaves printing to its caller: it returns errors and logs through tracing. +#![warn(clippy::print_stdout, clippy::print_stderr)] /// OTLP export through the workspace's `reqwest`. mod export; diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index 3d1e86326..13e900f47 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -33,6 +33,8 @@ //! # Ok(()) //! # } //! ``` +// A library leaves printing to its caller: it returns errors and logs through tracing. +#![warn(clippy::print_stdout, clippy::print_stderr)] /// The admin dashboard, and auth's page handing administrators off to it. mod admin; diff --git a/docs/dev/rust-conventions.md b/docs/dev/rust-conventions.md index 0bd456d47..22af84b0a 100644 --- a/docs/dev/rust-conventions.md +++ b/docs/dev/rust-conventions.md @@ -322,6 +322,8 @@ use `?` when a conversion already exists. Do not use `Result<_, ()>` or producti can quote personal data, and explain that exception in the code. Gate test helpers with `#[cfg(test)]`. Clippy enforces this: it denies `unwrap`, `todo!` and `unimplemented!` everywhere, and `expect`, `panic!` and `dbg!` outside tests (`clippy.toml`). +The library crates in `crates/` never print (`print_stdout`, `print_stderr`): they +return errors, and the application decides where output goes. Helpers return the feature's domain error. Browser handlers return `ApiError` through `From`; that exhaustive mapping owns public statuses and