In rust-nightly CI, forbid debugging prints.

This patch makes the rust-nightly CI task fail if it detects any
dbg!(), println!(), or eprintln!() calls in production code.

Because of clippy limitations, it may also gripe about calls to
these macros in our tests.  The preferred workarounds are to either
instead.  Both are acceptable.

We're doing this check in CI rather than unconditionally with clippy
directives, since we often want to have these calls in our code
temporarily while we're developing.  Some day we might want this
test to go into a pre-push hook.

This patch also adds #![allow()] directives for println!() and
eprintln!() in the arti crate.  Since that one isn't a library, it's
okay for it to speak to stdout/stderr.

Closes #218.
This commit is contained in:
Nick Mathewson 2021-11-04 11:13:29 -04:00
parent 8833f7a3a2
commit 753cbc9626
2 changed files with 5 additions and 1 deletions

View File

@ -40,7 +40,8 @@ rust-nightly:
- cargo build --verbose --target x86_64-unknown-linux-gnu --all-features - cargo build --verbose --target x86_64-unknown-linux-gnu --all-features
- cargo test --verbose --all-features - cargo test --verbose --all-features
- rustup component add clippy - rustup component add clippy
- cargo clippy --all-features # We check these extra warnings on CI only, since we don't want to forbid them while developing.
- cargo clippy --all-features -- -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr
- RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --document-private-items - RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --document-private-items
tags: tags:
- amd64 - amd64

View File

@ -82,6 +82,9 @@
#![deny(clippy::unnecessary_wraps)] #![deny(clippy::unnecessary_wraps)]
#![warn(clippy::unseparated_literal_suffix)] #![warn(clippy::unseparated_literal_suffix)]
#![deny(clippy::unwrap_used)] #![deny(clippy::unwrap_used)]
// These are allowed in this crate only.
#![allow(clippy::print_stderr)]
#![allow(clippy::print_stdout)]
mod exit; mod exit;
mod process; mod process;