Ensure library build only includes specified features

This commit is contained in:
Tobie Morgan Hitchcock 2022-07-03 10:43:23 +01:00
parent d5a6f80460
commit bc16645d38

View file

@ -128,14 +128,18 @@ impl Function {
} }
fnc::run(ctx, s, a).await fnc::run(ctx, s, a).await
} }
#[allow(unused_variables)]
Function::Script(s, x) => { Function::Script(s, x) => {
if cfg!(feature = "scripting") { #[cfg(feature = "scripting")]
{
let mut a: Vec<Value> = Vec::with_capacity(x.len()); let mut a: Vec<Value> = Vec::with_capacity(x.len());
for v in x { for v in x {
a.push(v.compute(ctx, opt, txn, doc).await?); a.push(v.compute(ctx, opt, txn, doc).await?);
} }
fnc::script::run(ctx, s, a, doc) fnc::script::run(ctx, s, a, doc)
} else { }
#[cfg(not(feature = "scripting"))]
{
Err(Error::InvalidScript { Err(Error::InvalidScript {
message: String::from("Embedded functions are not enabled."), message: String::from("Embedded functions are not enabled."),
}) })