From 605bc9dadb7d7e31f470cad3b7470b671b729586 Mon Sep 17 00:00:00 2001 From: ilammy Date: Mon, 23 Dec 2019 18:23:11 +0200 Subject: [PATCH 1/2] Fix clippy::needless-doctest-main Recently released Clippy 1.40 ships with this lint enabled by default. Since we run with "warnings as errors" policy, this lint causes build failures which is not nice. error: needless `fn main` in doctest --> src/wrappers/themis/rust/libthemis-src/src/lib.rs:37:4 | 37 | //! fn main() { | ^^^^^^^^^^^^ | = note: `-D clippy::needless-doctest-main` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main error: aborting due to previous error I wouldn't say that explicit main() here is needless and some people share the same sentiment [1]. However, since this is top-level module docs, we cannot disable this lint for this place specifically without turning it off in the entire module. Okay, Clippy, you win. [1]: https://github.com/rust-lang/rust-clippy/issues/4858 --- src/wrappers/themis/rust/libthemis-src/src/lib.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/wrappers/themis/rust/libthemis-src/src/lib.rs b/src/wrappers/themis/rust/libthemis-src/src/lib.rs index 4b639c9f7..7ffc512a0 100644 --- a/src/wrappers/themis/rust/libthemis-src/src/lib.rs +++ b/src/wrappers/themis/rust/libthemis-src/src/lib.rs @@ -34,14 +34,12 @@ //! Typical usage from a `*-sys` crate looks like this: //! //! ```no_run -//! fn main() { -//! #[cfg(feature = "vendored")] -//! libthemis_src::make(); +//! #[cfg(feature = "vendored")] +//! libthemis_src::make(); //! -//! // Go on with your usual build.rs business, pkg_config crate -//! // should be able to locate the local installation of Themis. -//! // You'll probably need to use the static library. -//! } +//! // Go on with your usual build.rs business, pkg_config crate +//! // should be able to locate the local installation of Themis. +//! // You'll probably need to use the static library. //! ``` use std::env; From dd82f014a85826b834f80e78808603f3f86acf81 Mon Sep 17 00:00:00 2001 From: ilammy Date: Mon, 23 Dec 2019 19:16:09 +0200 Subject: [PATCH 2/2] Fix Cargo with "--features" No idea what changed here, but for some reason Cargo does not allow to use "--features" with virtual crates now. However, it has no issues with it once we're in "themis" crate subdirectory and ask to document all crates in the workspace anyway. Apparently, "--features" was not supposed to work with workspaces in the first place [1], but I have no clue it worked before. [1]: https://github.com/rust-lang/cargo/issues/5015 --- tests/rust/run_tests.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/rust/run_tests.sh b/tests/rust/run_tests.sh index a20f8a27e..f7d8d8ca8 100755 --- a/tests/rust/run_tests.sh +++ b/tests/rust/run_tests.sh @@ -31,8 +31,13 @@ cargo test --all -- --test-threads 1 echo echo "Checking documentation..." echo -cargo clean --doc && cargo doc --no-deps -cargo clean --doc && cargo doc --no-deps --features "vendored" +# Cargo does not allow "--features" to be used with virtual crate in workspace. +# Jump into RustThemis subdirectory to make Cargo happy and use "--workspace" +# to still document all crates in the workspace. +cd src/wrappers/themis/rust +cargo clean --doc && cargo doc --workspace --no-deps +cargo clean --doc && cargo doc --workspace --no-deps --features "vendored" +cd - echo echo "Rust tests OK!"