Skip to content

Commit 4a81815

Browse files
authored
Fix compatibility with Rust 1.40 (#571)
* 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]: rust-lang/rust-clippy#4858 * 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]: rust-lang/cargo#5015
1 parent 231541d commit 4a81815

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/wrappers/themis/rust/libthemis-src/src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@
3434
//! Typical usage from a `*-sys` crate looks like this:
3535
//!
3636
//! ```no_run
37-
//! fn main() {
38-
//! #[cfg(feature = "vendored")]
39-
//! libthemis_src::make();
37+
//! #[cfg(feature = "vendored")]
38+
//! libthemis_src::make();
4039
//!
41-
//! // Go on with your usual build.rs business, pkg_config crate
42-
//! // should be able to locate the local installation of Themis.
43-
//! // You'll probably need to use the static library.
44-
//! }
40+
//! // Go on with your usual build.rs business, pkg_config crate
41+
//! // should be able to locate the local installation of Themis.
42+
//! // You'll probably need to use the static library.
4543
//! ```
4644
4745
use std::env;

tests/rust/run_tests.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ cargo test --all -- --test-threads 1
3131
echo
3232
echo "Checking documentation..."
3333
echo
34-
cargo clean --doc && cargo doc --no-deps
35-
cargo clean --doc && cargo doc --no-deps --features "vendored"
34+
# Cargo does not allow "--features" to be used with virtual crate in workspace.
35+
# Jump into RustThemis subdirectory to make Cargo happy and use "--workspace"
36+
# to still document all crates in the workspace.
37+
cd src/wrappers/themis/rust
38+
cargo clean --doc && cargo doc --workspace --no-deps
39+
cargo clean --doc && cargo doc --workspace --no-deps --features "vendored"
40+
cd -
3641

3742
echo
3843
echo "Rust tests OK!"

0 commit comments

Comments
 (0)