From 43113068974845a28edd086ca2a865a21db46018 Mon Sep 17 00:00:00 2001 From: Billy Sheppard Date: Fri, 4 Oct 2024 01:22:19 +0000 Subject: [PATCH] 0.0.41 --- Cargo.lock | 2 +- Cargo.toml | 2 +- build.rs | 4 ++-- src/utils.rs | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86ba8b7..0df3946 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,7 +124,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chart-js-rs" -version = "0.0.40" +version = "0.0.41" dependencies = [ "gloo-console", "gloo-utils", diff --git a/Cargo.toml b/Cargo.toml index 01278e9..86f3234 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chart-js-rs" -version = "0.0.40" +version = "0.0.41" edition = "2021" authors = ["Billy Sheppard", "Luis Moreno"] license = "Apache-2.0" diff --git a/build.rs b/build.rs index 1d7c8d9..177a6db 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,6 @@ #![allow(clippy::ptr_arg, clippy::collapsible_if)] -use std::{fmt::Debug, io::Write, ops::Not}; +use std::{io::Write, ops::Not}; use heck::ToSnakeCase; use itertools::Itertools; @@ -285,7 +285,7 @@ fn ident(i: &str) -> Result { syn::parse_str(i) } -// fn append_log(s: impl Debug) { +// fn append_log(s: impl std::fmt::Debug) { // let mut file = std::fs::OpenOptions::new() // .append(true) // .open("build_logs.txt") diff --git a/src/utils.rs b/src/utils.rs index e560b83..8fcdcc8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -158,7 +158,7 @@ impl Chart { rationalise_2_levels::<1>(&dataset, ("datalabels", "formatter")); rationalise_2_levels::<1>(&dataset, ("datalabels", "offset")); }); - + // Handle options.scales if let Some(scales) = object_values_at(&self.obj, "options.scales") { Object::values(&scales.dyn_into().unwrap()) @@ -166,13 +166,12 @@ impl Chart { .for_each(|scale| { rationalise_2_levels::<3>(&scale, ("ticks", "callback")); }); - } - + } + // Handle options.plugins.legend if let Some(legend) = object_values_at(&self.obj, "options.plugins.legend") { rationalise_2_levels::<2>(&legend, ("labels", "filter")); } - // Handle options.plugins.tooltip if let Some(legend) = object_values_at(&self.obj, "options.plugins.tooltip") { rationalise_1_level::<1>(&legend, "filter"); @@ -248,7 +247,8 @@ impl Serialize for FnWithArgs { impl FnWithArgs { pub fn is_empty(&self) -> bool { - self.args.is_empty() && self.body.is_empty() + self.args.iter().any(|arg| arg.is_empty()) || ( + self.args.is_empty() && self.body.is_empty()) } pub fn new() -> Self {