Skip to content

Commit 240c8fe

Browse files
committed
apply clippy and fmt fixes
Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent 3f29156 commit 240c8fe

File tree

13 files changed

+47
-53
lines changed

13 files changed

+47
-53
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ A plotting library for Rust powered by [Plotly.js](https://plot.ly/javascript/).
5353

5454
Documentation and numerous interactive examples are available in the [Plotly.rs Book](https://plotly.github.io/plotly.rs/content/getting_started.html), the [examples/](https://github.com/plotly/plotly.rs/tree/main/examples) directory and [docs.rs](https://docs.rs/crate/plotly).
5555

56-
5756
For changes since the last version, please consult the [changelog](https://github.com/plotly/plotly.rs/tree/main/CHANGELOG.md).
5857

5958
# Basic Usage
@@ -62,7 +61,7 @@ Add this to your `Cargo.toml`:
6261

6362
```toml
6463
[dependencies]
65-
plotly = "0.12"
64+
plotly = "0.13"
6665
```
6766

6867
## Exporting a single Interactive Plot
@@ -114,7 +113,7 @@ The recommended way to export static images is using the `plotly_static` backend
114113

115114
```toml
116115
[dependencies]
117-
plotly = { version = "0.12", features = ["static_export_default"] }
116+
plotly = { version = "0.13", features = ["static_export_default"] }
118117
```
119118

120119
This supports PNG, JPEG, WEBP, SVG, and PDF formats:
@@ -141,7 +140,7 @@ Enable the `kaleido` feature and opt in for automatic downloading of the `kaleid
141140
# Cargo.toml
142141

143142
[dependencies]
144-
plotly = { version = "0.12", features = ["kaleido", "kaleido_download"] }
143+
plotly = { version = "0.13", features = ["kaleido", "kaleido_download"] }
145144
```
146145

147146
Alternatively, enable only the `kaleido` feature and manually install Kaleido.

docs/book/src/fundamentals/static_image_export.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ The static export functionality is controlled by feature flags in the main `plot
1616

1717
### Optional Features:
1818
- `static_export_downloader`: Automatically downloads WebDriver binaries at build time
19-
- `static_export_default`: Convenience feature that includes geckodriver + downloader
19+
- `static_export_default`: Convenience feature that includes chromedriver + downloader
2020

2121
### Cargo.toml Configuration Examples:
2222

2323
```toml
2424
# Basic usage with manual WebDriver installation
2525
[dependencies]
26-
plotly = { version = "0.12", features = ["static_export_chromedriver"] }
26+
plotly = { version = "0.13", features = ["static_export_chromedriver"] }
2727

2828
# With automatic WebDriver download
2929
[dependencies]
30-
plotly = { version = "0.12", features = ["static_export_chromedriver", "static_export_downloader"] }
30+
plotly = { version = "0.13", features = ["static_export_chromedriver", "static_export_downloader"] }
3131

3232
# Recommended: Default configuration with Firefox + auto-download
3333
[dependencies]
34-
plotly = { version = "0.12", features = ["static_export_default"] }
34+
plotly = { version = "0.13", features = ["static_export_default"] }
3535
```
3636

3737
## Prerequisites

docs/book/src/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To start using [plotly.rs](https://github.com/plotly/plotly.rs) in your project
2222

2323
```toml
2424
[dependencies]
25-
plotly = "0.12"
25+
plotly = "0.13"
2626
```
2727

2828
[Plotly.rs](https://github.com/plotly/plotly.rs) is ultimately a thin wrapper around the `plotly.js` library. The main job of this library is to provide `structs` and `enums` which get serialized to `json` and passed to the `plotly.js` library to actually do the heavy lifting. As such, if you are familiar with `plotly.js` or its derivatives (e.g. the equivalent Python library), then you should find [`plotly.rs`](https://github.com/plotly/plotly.rs) intuitive to use.

examples/static_export/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ The `plotly_static` crate provides a high-level interface for converting Plotly
2424

2525
The example uses `static_export_default` which includes:
2626
- `plotly_static`: Core static export functionality
27-
- `plotly_static/geckodriver`: Firefox WebDriver support
27+
- `plotly_static/chromedriver`: Chrome WebDriver support
2828
- `plotly_static/webdriver_download`: Automatic WebDriver download
2929

3030
### Alternative Configurations
3131

3232
```toml
3333
# Use Chrome/Chromium instead of Firefox
34-
plotly = { version = "0.12", features = ["static_export_chromedriver", "static_export_downloader"] }
34+
plotly = { version = "0.13", features = ["static_export_chromedriver", "static_export_downloader"] }
3535

3636
# Manual WebDriver installation (no automatic download)
37-
plotly = { version = "0.12", features = ["static_export_geckodriver"] }
37+
plotly = { version = "0.13", features = ["static_export_geckodriver"] }
3838

3939
# Chrome with manual installation
40-
plotly = { version = "0.12", features = ["static_export_chromedriver"] }
40+
plotly = { version = "0.13", features = ["static_export_chromedriver"] }
4141
```
4242

4343
## Running the Example
@@ -92,4 +92,4 @@ Set `RUST_LOG=debug` to see detailed WebDriver operations and troubleshooting in
9292
- [plotly_static crate documentation](https://docs.rs/plotly_static/)
9393
- [WebDriver specification](https://w3c.github.io/webdriver/)
9494
- [GeckoDriver documentation](https://firefox-source-docs.mozilla.org/testing/geckodriver/)
95-
- [ChromeDriver documentation](https://chromedriver.chromium.org/)
95+
- [ChromeDriver documentation](https://chromedriver.chromium.org/)

plotly/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotly"
3-
version = "0.12.1"
3+
version = "0.13.0"
44
description = "A plotting library powered by Plotly.js"
55
authors = ["Ioannis Giagkiozis <[email protected]>", "Andrei Gherghescu <[email protected]>"]
66
license = "MIT"
@@ -22,7 +22,10 @@ kaleido_download = ["plotly_kaleido/download"]
2222
static_export_downloader = ["plotly_static/webdriver_download"]
2323
static_export_chromedriver = ["plotly_static", "plotly_static/chromedriver"]
2424
static_export_geckodriver = ["plotly_static", "plotly_static/geckodriver"]
25-
static_export_default = ["plotly_static", "plotly_static/geckodriver", "plotly_static/webdriver_download"]
25+
static_export_default = ["plotly_static", "plotly_static/chromedriver", "plotly_static/webdriver_download"]
26+
27+
# All non-conflicting features
28+
all = ["plotly_ndarray", "plotly_image", "plotly_embed_js", "static_export_default"]
2629

2730
plotly_ndarray = ["ndarray"]
2831
plotly_image = ["image"]
@@ -33,7 +36,7 @@ askama = { version = "0.14.0", features = ["serde_json"] }
3336
dyn-clone = "1"
3437
erased-serde = "0.4"
3538
image = { version = "0.25", optional = true }
36-
plotly_derive = { version = "0.12", path = "../plotly_derive" }
39+
plotly_derive = { version = "0.13", path = "../plotly_derive" }
3740
plotly_static = { version = "0.0.1", path = "../plotly_static", optional = true }
3841
plotly_kaleido = { version = "0.12", path = "../plotly_kaleido", optional = true }
3942
ndarray = { version = "0.16", optional = true }

plotly/src/layout/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ impl std::fmt::Display for ControlBuilderError {
6565
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6666
match self {
6767
ControlBuilderError::RestyleSerializationError(e) => {
68-
write!(f, "Failed to serialize restyle: {}", e)
68+
write!(f, "Failed to serialize restyle: {e}")
6969
}
7070
ControlBuilderError::RelayoutSerializationError(e) => {
71-
write!(f, "Failed to serialize relayout: {}", e)
71+
write!(f, "Failed to serialize relayout: {e}")
7272
}
7373
ControlBuilderError::ValueSerializationError(e) => {
74-
write!(f, "Failed to serialize value: {}", e)
74+
write!(f, "Failed to serialize value: {e}")
7575
}
7676
ControlBuilderError::InvalidRestyleObject(s) => {
77-
write!(f, "Invalid restyle object: expected object but got {}", s)
77+
write!(f, "Invalid restyle object: expected object but got {s}")
7878
}
7979
ControlBuilderError::InvalidRelayoutObject(s) => {
80-
write!(f, "Invalid relayout object: expected object but got {}", s)
80+
write!(f, "Invalid relayout object: expected object but got {s}")
8181
}
8282
}
8383
}

plotly/src/plot.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl Plot {
233233
let mut temp = env::temp_dir();
234234
let mut plot_name = Alphanumeric.sample_string(&mut rng(), 22);
235235
plot_name.push_str(".html");
236-
plot_name = format!("plotly_{}", plot_name);
236+
plot_name = format!("plotly_{plot_name}");
237237
temp.push(plot_name);
238238

239239
// Save the rendered plot to the temp file.
@@ -276,7 +276,7 @@ impl Plot {
276276
let mut temp = env::temp_dir();
277277
let mut plot_name = Alphanumeric.sample_string(&mut rng(), 22);
278278
plot_name.push_str(".html");
279-
plot_name = format!("plotly_{}", plot_name);
279+
plot_name = format!("plotly_{plot_name}");
280280
temp.push(plot_name);
281281

282282
// Save the rendered plot to the temp file.
@@ -350,18 +350,14 @@ impl Plot {
350350
/// Display plot in Jupyter Notebook.
351351
pub fn notebook_display(&self) {
352352
let plot_data = self.to_jupyter_notebook_html();
353-
println!(
354-
"EVCXR_BEGIN_CONTENT text/html\n{}\nEVCXR_END_CONTENT",
355-
plot_data
356-
);
353+
println!("EVCXR_BEGIN_CONTENT text/html\n{plot_data}\nEVCXR_END_CONTENT");
357354
}
358355

359356
/// Display plot in Jupyter Lab.
360357
pub fn lab_display(&self) {
361358
let plot_data = self.to_json();
362359
println!(
363-
"EVCXR_BEGIN_CONTENT application/vnd.plotly.v1+json\n{}\nEVCXR_END_CONTENT",
364-
plot_data
360+
"EVCXR_BEGIN_CONTENT application/vnd.plotly.v1+json\n{plot_data}\nEVCXR_END_CONTENT"
365361
);
366362
}
367363

@@ -487,7 +483,7 @@ impl Plot {
487483
) -> Result<(), Box<dyn std::error::Error>> {
488484
let mut exporter = plotly_static::StaticExporterBuilder::default()
489485
.build()
490-
.map_err(|e| format!("Failed to create StaticExporter: {}", e))?;
486+
.map_err(|e| format!("Failed to create StaticExporter: {e}"))?;
491487
self.write_image_with_exporter(&mut exporter, filename, format, width, height, scale)
492488
}
493489

@@ -515,7 +511,7 @@ impl Plot {
515511
) -> Result<String, Box<dyn std::error::Error>> {
516512
let mut exporter = plotly_static::StaticExporterBuilder::default()
517513
.build()
518-
.map_err(|e| format!("Failed to create StaticExporter: {}", e))?;
514+
.map_err(|e| format!("Failed to create StaticExporter: {e}"))?;
519515
self.to_base64_with_exporter(&mut exporter, format, width, height, scale)
520516
}
521517

@@ -538,7 +534,7 @@ impl Plot {
538534
) -> Result<String, Box<dyn std::error::Error>> {
539535
let mut exporter = plotly_static::StaticExporterBuilder::default()
540536
.build()
541-
.map_err(|e| format!("Failed to create StaticExporter: {}", e))?;
537+
.map_err(|e| format!("Failed to create StaticExporter: {e}"))?;
542538
self.to_svg_with_exporter(&mut exporter, width, height, scale)
543539
}
544540

@@ -752,9 +748,8 @@ impl Plot {
752748
let local_plotly_js = include_str!("../resource/plotly.min.js");
753749

754750
format!(
755-
"<script type=\"text/javascript\">{}</script>\n
756-
<script type=\"text/javascript\">{}</script>\n",
757-
local_plotly_js, local_tex_svg_js,
751+
"<script type=\"text/javascript\">{local_plotly_js}</script>\n
752+
<script type=\"text/javascript\">{local_tex_svg_js}</script>\n",
758753
)
759754
.to_string()
760755
}

plotly_derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotly_derive"
3-
version = "0.12.1"
3+
version = "0.13.0"
44
description = "Internal proc macro crate for Plotly-rs."
55
authors = ["Ioannis Giagkiozis <[email protected]>"]
66
license = "MIT"

plotly_derive/src/field_setter.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) fn field_setter_impl(input: DeriveInput) -> proc_macro::TokenStream {
1010
Ok(r) => r,
1111
Err(e) => {
1212
return proc_macro::TokenStream::from(
13-
darling::Error::custom(format!("{}. {}", UNSUPPORTED_ERROR, e)).write_errors(),
13+
darling::Error::custom(format!("{UNSUPPORTED_ERROR}. {e}")).write_errors(),
1414
)
1515
}
1616
};
@@ -263,8 +263,7 @@ impl FieldReceiver {
263263
// Require a default
264264
assert!(
265265
self.default.is_some(),
266-
"Please provide #[field_setter(default=\"..\") for the field {}",
267-
field_ident
266+
"Please provide #[field_setter(default=\"..\") for the field {field_ident}"
268267
);
269268
let val: proc_macro2::TokenStream = self.default.as_ref().unwrap().parse().unwrap();
270269
quote![
@@ -380,7 +379,7 @@ impl FieldReceiver {
380379
}
381380
}
382381
let variant_name = Ident::new(
383-
&format!("Modify{}", variant_name),
382+
&format!("Modify{variant_name}"),
384383
proc_macro2::Span::call_site(),
385384
);
386385
let serde_attrs = self.serde();
@@ -425,13 +424,13 @@ impl FieldReceiver {
425424
}) = &modify_enum
426425
{
427426
let modify_ident = Ident::new(
428-
&format!("modify_{}", field_ident),
427+
&format!("modify_{field_ident}"),
429428
proc_macro2::Span::call_site(),
430429
);
431430
match kind {
432431
Kind::Trace => {
433432
let modify_all_ident = Ident::new(
434-
&format!("modify_all_{}", field_ident),
433+
&format!("modify_all_{field_ident}"),
435434
proc_macro2::Span::call_site(),
436435
);
437436

@@ -467,7 +466,7 @@ impl FieldReceiver {
467466
let array_setter = match field_type {
468467
FieldType::OptionDimString | FieldType::OptionDimOther(..) => {
469468
let array_ident = Ident::new(
470-
&format!("{}_array", field_ident),
469+
&format!("{field_ident}_array"),
471470
proc_macro2::Span::call_site(),
472471
);
473472
quote! {

plotly_kaleido/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotly_kaleido"
3-
version = "0.12.1"
3+
version = "0.12.2"
44
description = "Additional output format support for plotly using Kaleido"
55
authors = [
66
"Ioannis Giagkiozis <[email protected]>",

0 commit comments

Comments
 (0)