From f43d483090008a63716459a5a19b38772bd4d1f8 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 7 Dec 2023 22:57:36 +0800 Subject: [PATCH] fix(cli): --features and --no-default-features should not be exclusive (#1846) --- cli/src/api/build.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/src/api/build.ts b/cli/src/api/build.ts index 07b1fcec..7cc1c49b 100644 --- a/cli/src/api/build.ts +++ b/cli/src/api/build.ts @@ -518,11 +518,17 @@ class Builder { private setFeatures() { const args = [] + if (this.options.allFeatures && this.options.allFeatures) { + throw new Error( + 'Cannot specify --all-features and --no-default-features together', + ) + } if (this.options.allFeatures) { args.push('--all-features') } else if (this.options.noDefaultFeatures) { args.push('--no-default-features') - } else if (this.options.features) { + } + if (this.options.features) { args.push('--features', ...this.options.features) }