Skip to content

Commit

Permalink
fixed clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
mchant authored and andrei-ng committed Nov 23, 2024
1 parent 75c6001 commit e5b6dc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
22 changes: 8 additions & 14 deletions plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ impl Plot {
height: usize,
scale: f64,
) -> Result<String, String> {
match format{
ImageFormat::JPEG => {},
ImageFormat::PNG => {},
ImageFormat::WEBP => {},
match format {
ImageFormat::JPEG => {}
ImageFormat::PNG => {}
ImageFormat::WEBP => {}
_ => {
return Err("Format can only be JPEG, PNG, WEBP are allowed".into());
},
}
}
let kaleido = plotly_kaleido::Kaleido::new();
let output = kaleido
Expand All @@ -449,23 +449,17 @@ impl Plot {

// similar to write_image, but returns svg contents
#[cfg(feature = "kaleido")]
pub fn to_svg(
&self,
width: usize,
height: usize,
scale: f64,
) -> String {
pub fn to_svg(&self, width: usize, height: usize, scale: f64) -> String {
let kaleido = plotly_kaleido::Kaleido::new();
let output = kaleido
kaleido
.get_image_data(
&serde_json::to_value(self).unwrap(),
"svg",
width,
height,
scale,
)
.unwrap_or_else(|_| panic!("failed to generate b64"));
output
.unwrap_or_else(|_| panic!("failed to generate b64"))
}

fn render(&self) -> String {
Expand Down
1 change: 0 additions & 1 deletion plotly_kaleido/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ impl Kaleido {
height: usize,
scale: f64,
) -> Result<String, Box<dyn std::error::Error>> {

let p = self.cmd_path.as_path();
let p = p.to_str().unwrap();
let p = String::from(p);
Expand Down

0 comments on commit e5b6dc6

Please sign in to comment.