From 47554556ec948af2f39673dd68c18be67b67bb12 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Thu, 9 Dec 2021 13:47:59 +0000 Subject: [PATCH 1/4] address lint warnings --- crates/tor-units/src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/tor-units/src/lib.rs b/crates/tor-units/src/lib.rs index 6acb80ad4..370954b1a 100644 --- a/crates/tor-units/src/lib.rs +++ b/crates/tor-units/src/lib.rs @@ -530,13 +530,11 @@ mod tests { #[test] fn bounded_from_i32() { - let mut x: Result, Error>; - - x = (50).try_into(); + let x: Result, _> = 50.try_into(); let y: i32 = x.unwrap().into(); assert_eq!(y, 50); - x = (1000).try_into(); + let x: Result, _> = 1000.try_into(); assert!(x.is_err()); } From e7bbe9e7a18d1d4dcd8d4415301fa3edb03ff723 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Thu, 9 Dec 2021 13:51:42 +0000 Subject: [PATCH 2/4] address lint warnings --- .cargo-husky/hooks/pre-commit | 4 ++-- .cargo-husky/hooks/pre-push | 4 ++-- crates/tor-llcrypto/tests/testvec.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit index 449eba189..e986843cf 100755 --- a/.cargo-husky/hooks/pre-commit +++ b/.cargo-husky/hooks/pre-commit @@ -8,8 +8,8 @@ set -e echo '+cargo fmt --all -- --check' cargo fmt --all -- --check -echo '+cargo clippy --all-features -- -D warnings' -cargo clippy --all-features -- -D warnings +echo '+cargo clippy --all-features --all-targets -- -D warnings' +cargo clippy --all-features --all-targets -- -D warnings echo '+cargo test --all' cargo test --all diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push index 449eba189..e986843cf 100755 --- a/.cargo-husky/hooks/pre-push +++ b/.cargo-husky/hooks/pre-push @@ -8,8 +8,8 @@ set -e echo '+cargo fmt --all -- --check' cargo fmt --all -- --check -echo '+cargo clippy --all-features -- -D warnings' -cargo clippy --all-features -- -D warnings +echo '+cargo clippy --all-features --all-targets -- -D warnings' +cargo clippy --all-features --all-targets -- -D warnings echo '+cargo test --all' cargo test --all diff --git a/crates/tor-llcrypto/tests/testvec.rs b/crates/tor-llcrypto/tests/testvec.rs index 1cccadc04..dcb832e11 100644 --- a/crates/tor-llcrypto/tests/testvec.rs +++ b/crates/tor-llcrypto/tests/testvec.rs @@ -567,7 +567,7 @@ rI2rzhqqBIhzFFaYuxyRAhkSBxCKTdl6X0k74ahT3MM= "; assert!(public.verify(&digest, &to_der(sig)).is_ok()); - assert!(!public.verify(&wrong_digest, &to_der(sig)).is_ok()); + assert!(public.verify(&wrong_digest, &to_der(sig)).is_err()); let val = rsa::ValidatableRsaSignature::new(&public, &to_der(sig), &digest); From fe788aad5e4686f276a37bb5c8fcc54f20152894 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Thu, 9 Dec 2021 14:30:41 +0000 Subject: [PATCH 3/4] update CI to test all targets --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26d373b93..9fd28936d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ rust-latest: - cargo build --verbose --target x86_64-unknown-linux-gnu - cargo test --verbose --target x86_64-unknown-linux-gnu - rustup component add clippy rustfmt - - cargo clippy --all-features --tests -- -D warnings + - cargo clippy --all-features --all-targets --tests -- -D warnings - cargo fmt -- --check - cp cargo-audit $CARGO_HOME/bin/ || cargo install cargo-audit - ./maint/cargo_audit.sh @@ -45,7 +45,7 @@ rust-nightly: - cargo test --verbose --target x86_64-unknown-linux-gnu --all-features - rustup component add clippy # 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 + - cargo clippy --all-features --all-targets -- -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr - RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --document-private-items tags: - amd64 From 88aba9e00734f974432e0424aaf0c6d76a704af3 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Thu, 9 Dec 2021 15:42:36 +0000 Subject: [PATCH 4/4] don't deny 'println' in examples in CI --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9fd28936d..b237cd071 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ rust-latest: - cargo build --verbose --target x86_64-unknown-linux-gnu - cargo test --verbose --target x86_64-unknown-linux-gnu - rustup component add clippy rustfmt - - cargo clippy --all-features --all-targets --tests -- -D warnings + - cargo clippy --all-features --all-targets -- -D warnings - cargo fmt -- --check - cp cargo-audit $CARGO_HOME/bin/ || cargo install cargo-audit - ./maint/cargo_audit.sh @@ -45,7 +45,7 @@ rust-nightly: - cargo test --verbose --target x86_64-unknown-linux-gnu --all-features - rustup component add clippy # We check these extra warnings on CI only, since we don't want to forbid them while developing. - - cargo clippy --all-features --all-targets -- -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr + - cargo clippy --all-features --tests -- -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr - RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --document-private-items tags: - amd64