Skip to content

Commit

Permalink
clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Aug 10, 2024
1 parent 43eea6a commit a755d92
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ pub fn parse_datetime_fallback(
date_str: &str,
default_input_tz: &Option<chrono_tz::Tz>,
) -> Option<DateTime<Utc>> {
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;
Expand Down
6 changes: 3 additions & 3 deletions vegafusion-jni/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,18 @@ 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 {
let _ = env.throw_new(
"io/vegafusion/VegaFusionException",
"Failed to parse args to innerPreTransformSpec",
);
return JObject::null().into_raw();
JObject::null().into_raw()
}
}
2 changes: 1 addition & 1 deletion vegafusion-python-embed/src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ fn expr_to_py(py: Python, expr: &Expr) -> Result<PyObject> {
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<u8> = proto_sort_expr.encode_to_vec();

Expand Down
11 changes: 5 additions & 6 deletions vegafusion-runtime/tests/test_chart_state.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
}
11 changes: 5 additions & 6 deletions vegafusion-runtime/tests/test_destringify_selection_datasets.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -60,9 +65,3 @@ mod tests {
}
}
}

fn crate_dir() -> String {
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.display()
.to_string()
}
11 changes: 5 additions & 6 deletions vegafusion-runtime/tests/test_pre_transform_extract.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -68,9 +73,3 @@ mod tests {
);
}
}

fn crate_dir() -> String {
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.display()
.to_string()
}
13 changes: 6 additions & 7 deletions vegafusion-runtime/tests/test_pre_transform_keep_variables.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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"
Expand All @@ -95,9 +100,3 @@ mod tests {
}
}
}

fn crate_dir() -> String {
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.display()
.to_string()
}
29 changes: 15 additions & 14 deletions vegafusion-runtime/tests/test_pre_transform_values.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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");
}
11 changes: 5 additions & 6 deletions vegafusion-runtime/tests/test_projection_pushdown.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -53,9 +58,3 @@ mod test_custom_specs {
}
}
}

fn crate_dir() -> String {
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.display()
.to_string()
}
2 changes: 1 addition & 1 deletion vegafusion-runtime/tests/util/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Result<Vec<ScalarValue>>>()
.unwrap();
(result_data, result_signals)
Expand Down

0 comments on commit a755d92

Please sign in to comment.