diff --git a/cli/src/convert.rs b/cli/src/convert.rs index dde44961..87caaa40 100644 --- a/cli/src/convert.rs +++ b/cli/src/convert.rs @@ -38,8 +38,7 @@ pub fn convert_( let tree = usvg::Tree::from_str(&svg, &options).map_err(|err| err.to_string())?; - let pdf = - svg2pdf::to_pdf(&tree, conversion_options, page_options); + let pdf = svg2pdf::to_pdf(&tree, conversion_options, page_options); std::fs::write(output, pdf).map_err(|_| "Failed to write PDF file")?; diff --git a/src/lib.rs b/src/lib.rs index e86f3c54..fc89ab04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -166,10 +166,7 @@ pub fn to_pdf( conversion_options: ConversionOptions, page_options: PageOptions, ) -> Vec { - let mut ctx = Context::new( - tree, - conversion_options, - ); + let mut ctx = Context::new(tree, conversion_options); let mut pdf = Pdf::new(); let dpi_ratio = 72.0 / page_options.dpi; @@ -327,16 +324,10 @@ pub fn to_pdf( /// std::fs::write("target/embedded.pdf", pdf.finish())?; /// # Ok(()) } /// ``` -pub fn to_chunk( - tree: &Tree, - conversion_options: ConversionOptions -) -> (Chunk, Ref) { +pub fn to_chunk(tree: &Tree, conversion_options: ConversionOptions) -> (Chunk, Ref) { let mut chunk = Chunk::new(); - let mut ctx = Context::new( - tree, - conversion_options, - ); + let mut ctx = Context::new(tree, conversion_options); let x_ref = tree_to_xobject(tree, &mut chunk, &mut ctx); ctx.write_global_objects(&mut chunk); (chunk, x_ref) diff --git a/src/util/context.rs b/src/util/context.rs index 7e7b5f26..fb98c227 100644 --- a/src/util/context.rs +++ b/src/util/context.rs @@ -26,10 +26,7 @@ pub struct Context { } impl Context { - pub fn new( - tree: &Tree, - options: ConversionOptions - ) -> Self { + pub fn new(tree: &Tree, options: ConversionOptions) -> Self { let mut ctx = Self { ref_allocator: RefAllocator::new(), options, diff --git a/tests/src/api.rs b/tests/src/api.rs index fbbfdcaa..6aa62f40 100644 --- a/tests/src/api.rs +++ b/tests/src/api.rs @@ -1,7 +1,7 @@ #[allow(unused_imports)] use { - crate::FONTDB, crate::render_pdf, + crate::FONTDB, crate::{convert_svg, run_test_impl}, pdf_writer::{Content, Finish, Name, Pdf, Rect, Ref, Str}, std::collections::HashMap,