diff --git a/packages/autofmt/src/lib.rs b/packages/autofmt/src/lib.rs index 2de7b4002..114af3a55 100644 --- a/packages/autofmt/src/lib.rs +++ b/packages/autofmt/src/lib.rs @@ -132,7 +132,7 @@ pub fn fmt_file(contents: &str, indent: IndentOptions) -> Vec { formatted_blocks } -pub fn write_block_out(body: CallBody) -> Option { +pub fn write_block_out(body: &CallBody) -> Option { let mut buf = Writer::new(""); write_body(&mut buf, &body); diff --git a/packages/cli/src/cli/translate.rs b/packages/cli/src/cli/translate.rs index b157e7cfe..01c72a042 100644 --- a/packages/cli/src/cli/translate.rs +++ b/packages/cli/src/cli/translate.rs @@ -52,7 +52,7 @@ pub fn convert_html_to_formatted_rsx(dom: &Dom, component: bool) -> String { match component { true => write_callbody_with_icon_section(callbody), - false => dioxus_autofmt::write_block_out(callbody).unwrap(), + false => dioxus_autofmt::write_block_out(&callbody).unwrap(), } } @@ -61,7 +61,7 @@ fn write_callbody_with_icon_section(mut callbody: CallBody) -> String { rsx_rosetta::collect_svgs(&mut callbody.roots, &mut svgs); - let mut out = write_component_body(dioxus_autofmt::write_block_out(callbody).unwrap()); + let mut out = write_component_body(dioxus_autofmt::write_block_out(&callbody).unwrap()); if !svgs.is_empty() { write_svg_section(&mut out, svgs); @@ -81,7 +81,7 @@ fn write_svg_section(out: &mut String, svgs: Vec) { out.push_str("\n\nmod icons {"); out.push_str("\n use super::*;"); for (idx, icon) in svgs.into_iter().enumerate() { - let raw = dioxus_autofmt::write_block_out(CallBody { roots: vec![icon] }).unwrap(); + let raw = dioxus_autofmt::write_block_out(&CallBody { roots: vec![icon] }).unwrap(); out.push_str("\n\n pub fn icon_"); out.push_str(&idx.to_string()); out.push_str("() -> Element {\n rsx! {"); diff --git a/packages/extension/src/lib.rs b/packages/extension/src/lib.rs index 81e7906cc..c31012025 100644 --- a/packages/extension/src/lib.rs +++ b/packages/extension/src/lib.rs @@ -89,5 +89,5 @@ pub fn translate_rsx(contents: String, _component: bool) -> String { let callbody = rsx_rosetta::rsx_from_html(&dom); // Convert the HTML to RSX - dioxus_autofmt::write_block_out(callbody).unwrap() + dioxus_autofmt::write_block_out(&callbody).unwrap() } diff --git a/packages/rsx-rosetta/examples/html.rs b/packages/rsx-rosetta/examples/html.rs index ff9af0ed7..013dcd926 100644 --- a/packages/rsx-rosetta/examples/html.rs +++ b/packages/rsx-rosetta/examples/html.rs @@ -18,7 +18,7 @@ fn main() { let body = rsx_rosetta::rsx_from_html(&dom); - let out = dioxus_autofmt::write_block_out(body).unwrap(); + let out = dioxus_autofmt::write_block_out(&body).unwrap(); println!("{out}"); } diff --git a/packages/rsx-rosetta/tests/h-tags.rs b/packages/rsx-rosetta/tests/h-tags.rs index eb179c57f..ce9db6552 100644 --- a/packages/rsx-rosetta/tests/h-tags.rs +++ b/packages/rsx-rosetta/tests/h-tags.rs @@ -18,7 +18,7 @@ fn h_tags_translate() { let body = rsx_rosetta::rsx_from_html(&dom); - let out = dioxus_autofmt::write_block_out(body).unwrap(); + let out = dioxus_autofmt::write_block_out(&body).unwrap(); let expected = r#" div { diff --git a/packages/rsx-rosetta/tests/raw.rs b/packages/rsx-rosetta/tests/raw.rs index 5a5fd6171..5a5c3d1b3 100644 --- a/packages/rsx-rosetta/tests/raw.rs +++ b/packages/rsx-rosetta/tests/raw.rs @@ -13,7 +13,7 @@ fn raw_attribute() { let body = rsx_rosetta::rsx_from_html(&dom); - let out = dioxus_autofmt::write_block_out(body).unwrap(); + let out = dioxus_autofmt::write_block_out(&body).unwrap(); let expected = r#" div { diff --git a/packages/rsx-rosetta/tests/simple.rs b/packages/rsx-rosetta/tests/simple.rs index f52c18964..21ecfc710 100644 --- a/packages/rsx-rosetta/tests/simple.rs +++ b/packages/rsx-rosetta/tests/simple.rs @@ -17,7 +17,7 @@ fn simple_elements() { let body = rsx_rosetta::rsx_from_html(&dom); - let out = dioxus_autofmt::write_block_out(body).unwrap(); + let out = dioxus_autofmt::write_block_out(&body).unwrap(); let expected = r#" div { @@ -50,7 +50,7 @@ fn deeply_nested() { let body = rsx_rosetta::rsx_from_html(&dom); - let out = dioxus_autofmt::write_block_out(body).unwrap(); + let out = dioxus_autofmt::write_block_out(&body).unwrap(); let expected = r#" div { diff --git a/packages/rsx-rosetta/tests/web-component.rs b/packages/rsx-rosetta/tests/web-component.rs index 7bf1a69df..2b9e4ca10 100644 --- a/packages/rsx-rosetta/tests/web-component.rs +++ b/packages/rsx-rosetta/tests/web-component.rs @@ -13,7 +13,7 @@ fn web_components_translate() { let body = rsx_rosetta::rsx_from_html(&dom); - let out = dioxus_autofmt::write_block_out(body).unwrap(); + let out = dioxus_autofmt::write_block_out(&body).unwrap(); let expected = r#" div {