Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be20b0c

Browse filesBrowse files
committed
fix latest clippy issues
Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>
1 parent 30fa08d commit be20b0c
Copy full SHA for be20b0c

9 files changed

+33-40Lines changed: 33 additions & 40 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/custom_controls/src/main.rs‎

Copy file name to clipboardExpand all lines: examples/custom_controls/src/main.rs
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fn sinusoidal_slider_example(show: bool, file_name: &str) {
280280
Visible::False
281281
}) // Make 10th trace visible
282282
.line(plotly::common::Line::new().color("#00CED1").width(6.0))
283-
.name(format!("ν = {:.1}", frequency));
283+
.name(format!("ν = {frequency:.1}"));
284284
plot.add_trace(trace);
285285
}
286286

@@ -291,12 +291,11 @@ fn sinusoidal_slider_example(show: bool, file_name: &str) {
291291
let mut visible = vec![Visible::False; num_steps];
292292
visible[i] = Visible::True;
293293
let step = SliderStepBuilder::new()
294-
.label(format!("step-{}", i))
295-
.value(format!("{:.1}", frequency))
294+
.label(format!("step-{i}"))
295+
.value(format!("{frequency:.1}"))
296296
.push_restyle(Scatter::<f64, f64>::modify_visible(visible))
297297
.push_relayout(Layout::modify_title(format!(
298-
"Slider switched to step: {}",
299-
i
298+
"Slider switched to step: {i}"
300299
)))
301300
.build()
302301
.unwrap();
@@ -389,12 +388,11 @@ fn gdp_life_expectancy_slider_example(show: bool, file_name: &str) {
389388
visible[start..end].fill(Visible::True);
390389

391390
SliderStepBuilder::new()
392-
.label(format!("year = {}", year))
391+
.label(format!("year = {year}"))
393392
.value(year)
394393
.push_restyle(Scatter::<f64, f64>::modify_visible(visible))
395394
.push_relayout(Layout::modify_title(format!(
396-
"GDP vs. Life Expectancy ({})",
397-
year
395+
"GDP vs. Life Expectancy ({year})"
398396
)))
399397
.build()
400398
.unwrap()
Collapse file

‎examples/customization/src/main.rs‎

Copy file name to clipboardExpand all lines: examples/customization/src/main.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn multiple_plots_on_same_html_page(show: bool, file_name: &str) {
4949
.to_html_string();
5050

5151
std::fs::create_dir_all("./output").unwrap();
52-
let path = format!("./output/inline_{}.html", file_name);
52+
let path = format!("./output/inline_{file_name}.html");
5353
let mut file = File::create(&path).unwrap();
5454
file.write_all(html.as_bytes())
5555
.expect("failed to write html output");
Collapse file

‎examples/plotly_utils/src/lib.rs‎

Copy file name to clipboardExpand all lines: examples/plotly_utils/src/lib.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ pub fn write_example_to_html(plot: &Plot, name: &str) -> String {
1818
std::fs::create_dir_all("./output").unwrap();
1919
// Write inline HTML
2020
let html = plot.to_inline_html(Some(name));
21-
let path = format!("./output/inline_{}.html", name);
21+
let path = format!("./output/inline_{name}.html");
2222
std::fs::write(path, html).unwrap();
2323
// Write standalone HTML
24-
let path = format!("./output/{}.html", name);
24+
let path = format!("./output/{name}.html");
2525
plot.write_html(&path);
2626
path
2727
}
Collapse file

‎examples/subplots/src/main.rs‎

Copy file name to clipboardExpand all lines: examples/subplots/src/main.rs
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,16 @@ fn many_subplots_with_titles(show: bool, file_name: &str) {
360360
plot.add_trace(
361361
trace1
362362
.clone()
363-
.y_axis(format!("y{}", i))
364-
.x_axis(format!("x{}", i)),
363+
.y_axis(format!("y{i}"))
364+
.x_axis(format!("x{i}")),
365365
);
366366
layout.add_annotation(
367367
Annotation::new()
368-
.y_ref(format!("y{} domain", i))
368+
.y_ref(format!("y{i} domain"))
369369
.y_anchor(Anchor::Bottom)
370370
.y(1)
371-
.text(format!("Title {}", i))
372-
.x_ref(format!("x{} domain", i))
371+
.text(format!("Title {i}"))
372+
.x_ref(format!("x{i} domain"))
373373
.x_anchor(Anchor::Center)
374374
.x(0.5)
375375
.show_arrow(false),
Collapse file

‎plotly/src/layout/mod.rs‎

Copy file name to clipboardExpand all lines: plotly/src/layout/mod.rs
+5-5Lines 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
}
Collapse file

‎plotly/src/plot.rs‎

Copy file name to clipboardExpand all lines: plotly/src/plot.rs
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl Plot {
256256
let mut temp = env::temp_dir();
257257
let mut plot_name = Alphanumeric.sample_string(&mut rng(), 22);
258258
plot_name.push_str(".html");
259-
plot_name = format!("plotly_{}", plot_name);
259+
plot_name = format!("plotly_{plot_name}");
260260
temp.push(plot_name);
261261

262262
// Save the rendered plot to the temp file.
@@ -298,7 +298,7 @@ impl Plot {
298298
let mut temp = env::temp_dir();
299299
let mut plot_name = Alphanumeric.sample_string(&mut rng(), 22);
300300
plot_name.push_str(".html");
301-
plot_name = format!("plotly_{}", plot_name);
301+
plot_name = format!("plotly_{plot_name}");
302302
temp.push(plot_name);
303303

304304
// Save the rendered plot to the temp file.
@@ -372,18 +372,14 @@ impl Plot {
372372
/// Display plot in Jupyter Notebook.
373373
pub fn notebook_display(&self) {
374374
let plot_data = self.to_jupyter_notebook_html();
375-
println!(
376-
"EVCXR_BEGIN_CONTENT text/html\n{}\nEVCXR_END_CONTENT",
377-
plot_data
378-
);
375+
println!("EVCXR_BEGIN_CONTENT text/html\n{plot_data}\nEVCXR_END_CONTENT");
379376
}
380377

381378
/// Display plot in Jupyter Lab.
382379
pub fn lab_display(&self) {
383380
let plot_data = self.to_json();
384381
println!(
385-
"EVCXR_BEGIN_CONTENT application/vnd.plotly.v1+json\n{}\nEVCXR_END_CONTENT",
386-
plot_data
382+
"EVCXR_BEGIN_CONTENT application/vnd.plotly.v1+json\n{plot_data}\nEVCXR_END_CONTENT"
387383
);
388384
}
389385

Collapse file

‎plotly_derive/src/field_setter.rs‎

Copy file name to clipboardExpand all lines: plotly_derive/src/field_setter.rs
+6-7Lines 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! {
Collapse file

‎plotly_kaleido/build.rs‎

Copy file name to clipboardExpand all lines: plotly_kaleido/build.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ fn extract_zip(p: &Path, zip_file: &Path) -> Result<()> {
4444
let mut file = archive.by_index(i).unwrap();
4545
let outpath = file.mangled_name();
4646
let outpath = p.join(outpath);
47-
println!("outpath: {:?}", outpath);
47+
println!("outpath: {outpath:?}");
4848

4949
{
5050
let comment = file.comment();
5151
if !comment.is_empty() {
52-
println!("File {} comment: {}", i, comment);
52+
println!("File {i} comment: {comment}");
5353
}
5454
}
5555

Collapse file

‎plotly_kaleido/src/lib.rs‎

Copy file name to clipboardExpand all lines: plotly_kaleido/src/lib.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl Kaleido {
9898

9999
let path = match Kaleido::binary_path(&path) {
100100
Ok(kaleido_path) => kaleido_path,
101-
Err(msg) => panic!("Failed tu use Kaleido binary at {} due to {}", path, msg),
101+
Err(msg) => panic!("Failed tu use Kaleido binary at {path} due to {msg}"),
102102
};
103103

104104
Kaleido { cmd_path: path }
@@ -244,7 +244,7 @@ impl Kaleido {
244244
let stderr_lines = BufReader::new(stderr).lines();
245245
for line in stderr_lines {
246246
let line = line.unwrap();
247-
eprintln!("{}", line);
247+
eprintln!("{line}");
248248
}
249249

250250
Ok(String::default())

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.