diff --git a/vegafusion-datafusion-udfs/src/udfs/datetime/str_to_utc_timestamp.rs b/vegafusion-datafusion-udfs/src/udfs/datetime/str_to_utc_timestamp.rs index be2790d28..cc6f3333c 100644 --- a/vegafusion-datafusion-udfs/src/udfs/datetime/str_to_utc_timestamp.rs +++ b/vegafusion-datafusion-udfs/src/udfs/datetime/str_to_utc_timestamp.rs @@ -117,14 +117,14 @@ pub fn parse_datetime_fallback( date_str: &str, default_input_tz: &Option, ) -> Option> { - let mut date_tokens = vec![String::from(""), String::from(""), String::from("")]; - let mut time_tokens = vec![ + let mut date_tokens = [String::from(""), String::from(""), String::from("")]; + let mut time_tokens = [ String::from(""), String::from(""), String::from(""), String::from(""), ]; - let mut timezone_tokens = vec![String::from(""), String::from("")]; + let mut timezone_tokens = [String::from(""), String::from("")]; let mut timezone_sign = ' '; let mut date_ind = 0; let mut time_ind = 0; diff --git a/vegafusion-jni/src/lib.rs b/vegafusion-jni/src/lib.rs index 26e286ccf..5c48b28e5 100644 --- a/vegafusion-jni/src/lib.rs +++ b/vegafusion-jni/src/lib.rs @@ -312,11 +312,11 @@ pub unsafe extern "system" fn Java_io_vegafusion_VegaFusionRuntime_innerPreTrans } Ok(Err(vf_err)) => { let _ = env.throw_new("io/vegafusion/VegaFusionException", vf_err.to_string()); - return JObject::null().into_raw(); + JObject::null().into_raw() } Err(_unwind_err) => { let _ = env.throw_new("io/vegafusion/VegaFusionException", "Uncaught Error"); - return JObject::null().into_raw(); + JObject::null().into_raw() } } } else { @@ -324,6 +324,6 @@ pub unsafe extern "system" fn Java_io_vegafusion_VegaFusionRuntime_innerPreTrans "io/vegafusion/VegaFusionException", "Failed to parse args to innerPreTransformSpec", ); - return JObject::null().into_raw(); + JObject::null().into_raw() } } diff --git a/vegafusion-python-embed/src/dataframe.rs b/vegafusion-python-embed/src/dataframe.rs index 92ce298d6..b5d11f6d4 100644 --- a/vegafusion-python-embed/src/dataframe.rs +++ b/vegafusion-python-embed/src/dataframe.rs @@ -527,7 +527,7 @@ fn expr_to_py(py: Python, expr: &Expr) -> Result { let proto_module = PyModule::import(py, "vegafusion.proto.datafusion_pb2")?; let logical_expr_class = proto_module.getattr("LogicalExprNode")?; - let proto_sort_expr = serialize_expr(&expr, &extension_codec)?; + let proto_sort_expr = serialize_expr(expr, &extension_codec)?; let sort_expr_bytes: Vec = proto_sort_expr.encode_to_vec(); diff --git a/vegafusion-runtime/tests/test_chart_state.rs b/vegafusion-runtime/tests/test_chart_state.rs index 9059694f7..82ef107c1 100644 --- a/vegafusion-runtime/tests/test_chart_state.rs +++ b/vegafusion-runtime/tests/test_chart_state.rs @@ -1,3 +1,8 @@ +fn crate_dir() -> String { + std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .display() + .to_string() +} #[cfg(test)] mod tests { use crate::crate_dir; @@ -138,9 +143,3 @@ mod tests { assert_eq!(response_updates, expected_updates) } } - -fn crate_dir() -> String { - std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .display() - .to_string() -} diff --git a/vegafusion-runtime/tests/test_destringify_selection_datasets.rs b/vegafusion-runtime/tests/test_destringify_selection_datasets.rs index 6fbcee054..5872cb657 100644 --- a/vegafusion-runtime/tests/test_destringify_selection_datasets.rs +++ b/vegafusion-runtime/tests/test_destringify_selection_datasets.rs @@ -1,3 +1,8 @@ +fn crate_dir() -> String { + std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .display() + .to_string() +} #[cfg(test)] mod tests { use crate::crate_dir; @@ -60,9 +65,3 @@ mod tests { } } } - -fn crate_dir() -> String { - std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .display() - .to_string() -} diff --git a/vegafusion-runtime/tests/test_pre_transform_extract.rs b/vegafusion-runtime/tests/test_pre_transform_extract.rs index dcb811bc6..547dd0cdb 100644 --- a/vegafusion-runtime/tests/test_pre_transform_extract.rs +++ b/vegafusion-runtime/tests/test_pre_transform_extract.rs @@ -1,3 +1,8 @@ +fn crate_dir() -> String { + std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .display() + .to_string() +} #[cfg(test)] mod tests { use crate::crate_dir; @@ -68,9 +73,3 @@ mod tests { ); } } - -fn crate_dir() -> String { - std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .display() - .to_string() -} diff --git a/vegafusion-runtime/tests/test_pre_transform_keep_variables.rs b/vegafusion-runtime/tests/test_pre_transform_keep_variables.rs index 35e9be0d8..32e5330c9 100644 --- a/vegafusion-runtime/tests/test_pre_transform_keep_variables.rs +++ b/vegafusion-runtime/tests/test_pre_transform_keep_variables.rs @@ -1,3 +1,8 @@ +fn crate_dir() -> String { + std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .display() + .to_string() +} #[cfg(test)] mod tests { use crate::crate_dir; @@ -68,7 +73,7 @@ mod tests { assert!(warnings.is_empty()); assert_eq!(tx_spec.signals.len(), 1); - let signal0 = tx_spec.signals.get(0).unwrap(); + let signal0 = tx_spec.signals.first().unwrap(); assert_eq!( signal0.name, "layer_0_layer_0_bin_maxbins_10_IMDB_Rating_bins" @@ -95,9 +100,3 @@ mod tests { } } } - -fn crate_dir() -> String { - std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .display() - .to_string() -} diff --git a/vegafusion-runtime/tests/test_pre_transform_values.rs b/vegafusion-runtime/tests/test_pre_transform_values.rs index 7de4f92c7..f9ffa6284 100644 --- a/vegafusion-runtime/tests/test_pre_transform_values.rs +++ b/vegafusion-runtime/tests/test_pre_transform_values.rs @@ -1,3 +1,18 @@ +fn crate_dir() -> String { + std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .display() + .to_string() +} + +fn setup_s3_environment_vars() { + unsafe { + std::env::set_var("AWS_DEFAULT_REGION", "us-east-1"); + std::env::set_var("AWS_ACCESS_KEY_ID", "access_key123"); + std::env::set_var("AWS_SECRET_ACCESS_KEY", "secret_key123"); + std::env::set_var("AWS_ENDPOINT", "http://127.0.0.1:9000"); + std::env::set_var("AWS_ALLOW_HTTP", "true"); + } +} #[cfg(test)] mod tests { use crate::{crate_dir, setup_s3_environment_vars}; @@ -421,17 +436,3 @@ mod tests { } } } - -fn crate_dir() -> String { - std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .display() - .to_string() -} - -fn setup_s3_environment_vars() { - std::env::set_var("AWS_DEFAULT_REGION", "us-east-1"); - std::env::set_var("AWS_ACCESS_KEY_ID", "access_key123"); - std::env::set_var("AWS_SECRET_ACCESS_KEY", "secret_key123"); - std::env::set_var("AWS_ENDPOINT", "http://127.0.0.1:9000"); - std::env::set_var("AWS_ALLOW_HTTP", "true"); -} diff --git a/vegafusion-runtime/tests/test_projection_pushdown.rs b/vegafusion-runtime/tests/test_projection_pushdown.rs index 96584e597..886cfa464 100644 --- a/vegafusion-runtime/tests/test_projection_pushdown.rs +++ b/vegafusion-runtime/tests/test_projection_pushdown.rs @@ -1,3 +1,8 @@ +fn crate_dir() -> String { + std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .display() + .to_string() +} #[cfg(test)] mod test_custom_specs { use crate::crate_dir; @@ -53,9 +58,3 @@ mod test_custom_specs { } } } - -fn crate_dir() -> String { - std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .display() - .to_string() -} diff --git a/vegafusion-runtime/tests/util/check.rs b/vegafusion-runtime/tests/util/check.rs index ad7a27800..84dab9388 100644 --- a/vegafusion-runtime/tests/util/check.rs +++ b/vegafusion-runtime/tests/util/check.rs @@ -131,7 +131,7 @@ pub fn eval_vegafusion_transforms( .unwrap(); let result_signals = result_signals .into_iter() - .map(|v| v.as_scalar().map(|v| v.clone())) + .map(|v| v.as_scalar().cloned()) .collect::>>() .unwrap(); (result_data, result_signals)