From 33408146a178435d80871cdc91fad438144ded0f Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 1 Jan 2024 11:38:42 +0200 Subject: [PATCH] Fix feature permutation mis-compilations found with cargo-hack Signed-off-by: Manos Pitsidianakis --- Makefile | 5 +++++ meli/Cargo.toml | 5 ++--- meli/src/main.rs | 12 ++++++++++++ meli/src/state.rs | 2 +- meli/src/subcommands.rs | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 74be4a58..a885a141 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ TAGREF_BIN ?= tagref CARGO_ARGS ?= RUSTFLAGS ?= -D warnings -W unreachable-pub -W rust-2021-compatibility CARGO_SORT_BIN = cargo-sort +CARGO_HACK_BIN = cargo-hack PRINTF = /usr/bin/printf # Options @@ -119,6 +120,10 @@ test: test-docs test-docs: @RUSTFLAGS='${RUSTFLAGS}' ${CARGO_BIN} test ${CARGO_ARGS} ${CARGO_COLOR}--target-dir="${CARGO_TARGET_DIR}" --all --doc +.PHONY: test-feature-permutations +test-feature-permutations: + $(CARGO_HACK_BIN) hack --feature-powerset + .PHONY: check-deps check-deps: @(if ! echo ${MIN_RUSTC}\\n`${CARGO_BIN} --version | grep ^cargo | cut -d ' ' -f 2` | sort -CV; then echo "rust version >= ${RED}${MIN_RUSTC}${ANSI_RESET} required, found: `which ${CARGO_BIN}` `${CARGO_BIN} --version | cut -d ' ' -f 2`" \ diff --git a/meli/Cargo.toml b/meli/Cargo.toml index 46c19061..c6543d2b 100644 --- a/meli/Cargo.toml +++ b/meli/Cargo.toml @@ -31,7 +31,7 @@ indexmap = { version = "^1.6", features = ["serde-1"] } libc = { version = "0.2.125", default-features = false, features = ["extra_traits"] } libz-sys = { version = "1.1", features = ["static"], optional = true } linkify = { version = "^0.8", default-features = false } -melib = { path = "../melib", version = "0.8.5-rc.3" } +melib = { path = "../melib", version = "0.8.5-rc.3", features = ["unicode-algorithms"] } nix = { version = "^0.24", default-features = false } notify = { version = "4.0.1", default-features = false } # >:c num_cpus = "1.12.0" @@ -54,7 +54,7 @@ version = "0.2.3" optional = true [features] -default = ["sqlite3", "notmuch", "smtp", "dbus-notifications", "gpgme", "cli-docs", "jmap", "text-processing", "static"] +default = ["sqlite3", "notmuch", "smtp", "dbus-notifications", "gpgme", "cli-docs", "jmap", "static"] notmuch = ["melib/notmuch"] jmap = ["melib/jmap"] sqlite3 = ["melib/sqlite3"] @@ -64,7 +64,6 @@ regexp = ["dep:pcre2"] dbus-notifications = ["dep:notify-rust"] cli-docs = ["dep:flate2"] svgscreenshot = ["dep:svg_crate"] -text-processing = ["melib/unicode-algorithms"] gpgme = ["melib/gpgme"] # Static / vendoring features. tls-static = ["melib/tls-static"] diff --git a/meli/src/main.rs b/meli/src/main.rs index 02f97a48..7b7514d5 100644 --- a/meli/src/main.rs +++ b/meli/src/main.rs @@ -101,6 +101,11 @@ fn run_app(opt: Opt) -> Result<()> { Some(SubCommand::EditConfig) => { return subcommands::edit_config(); } + #[cfg(not(feature = "cli-docs"))] + Some(SubCommand::Man(ManOpt {})) => { + return Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli-email.org")); + } + #[cfg(feature = "cli-docs")] Some(SubCommand::Man(ManOpt { page, no_raw })) => { return subcommands::man(page, false).and_then(|s| subcommands::pager(s, no_raw)); } @@ -133,6 +138,13 @@ fn run_app(opt: Opt) -> Result<()> { println!("{}", temp_dir.display()); return Ok(()); } + #[cfg(not(feature = "cli-docs"))] + Some(SubCommand::InstallMan { + destination_path: _, + }) => { + return Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli-email.org")); + } + #[cfg(feature = "cli-docs")] Some(SubCommand::InstallMan { destination_path }) => { match args::manpages::ManPages::install(destination_path) { Ok(p) => println!("Installed at {}.", p.display()), diff --git a/meli/src/state.rs b/meli/src/state.rs index 243ca68b..8bf3e70e 100644 --- a/meli/src/state.rs +++ b/meli/src/state.rs @@ -839,7 +839,7 @@ impl State { title: None, source: None, body: "Message index rebuild failed: meli is not built with sqlite3 support." - .to_string(), + .into(), kind: Some(NotificationType::Error(ErrorKind::None)), }); } diff --git a/meli/src/subcommands.rs b/meli/src/subcommands.rs index a314b0c5..295b8596 100644 --- a/meli/src/subcommands.rs +++ b/meli/src/subcommands.rs @@ -134,7 +134,7 @@ pub fn pager(v: String, no_raw: Option>) -> Result<()> { #[cfg(not(feature = "cli-docs"))] pub fn man(_: ManOpt) -> Result<()> { - Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli.delivery")) + Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli-email.org")) } pub fn compiled_with() -> Result<()> {