Skip to content

Commit 5def132

Browse files
author
Ioannis Giagkiozis
committed
Refactor panic message format
1 parent 3d06377 commit 5def132

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

plotly/src/common/color.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,13 @@ impl Color for f64 {
383383

384384
fn string_types_to_color_wrapper<S: AsRef<str> + std::fmt::Display + Sized>(v: S) -> ColorWrapper {
385385
if v.as_ref().len() < 6 || v.as_ref().len() > 7 {
386-
panic!(format!("{} is not a valid hex color!", v));
386+
panic!("{} is not a valid hex color!", v);
387387
}
388388
if v.as_ref().len() == 6 && v.as_ref().starts_with('#') {
389-
panic!(format!("{} is not a valid hex color!", v));
389+
panic!("{} is not a valid hex color!", v);
390390
}
391391
if v.as_ref().len() == 7 && !v.as_ref().starts_with('#') {
392-
panic!(format!("{} is not a valid hex color!", v));
392+
panic!("{} is not a valid hex color!", v);
393393
}
394394
let valid_characters = "#ABCDEF0123456789";
395395
let mut s = v.as_ref().to_uppercase();
@@ -398,7 +398,7 @@ fn string_types_to_color_wrapper<S: AsRef<str> + std::fmt::Display + Sized>(v: S
398398
}
399399
for c in s.chars() {
400400
if !valid_characters.contains(c) {
401-
panic!(format!("{} is not a valid hex color!", v));
401+
panic!("{} is not a valid hex color!", v);
402402
}
403403
}
404404

plotly_kaleido/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Kaleido {
7878
pub fn new() -> Kaleido {
7979
let path = match Kaleido::binary_path() {
8080
Ok(path) => path,
81-
Err(msg) => panic!(msg),
81+
Err(msg) => panic!("{}", msg),
8282
};
8383

8484
Kaleido { cmd_path: path }

0 commit comments

Comments
 (0)