From 5c63ae4b5db9c822febdb0322436077749260aa1 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Thu, 29 Dec 2022 01:02:07 -0500 Subject: [PATCH] chore: dont panic --- packages/autofmt/src/lib.rs | 2 +- packages/rsx/src/node.rs | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/autofmt/src/lib.rs b/packages/autofmt/src/lib.rs index 37e5e1b33..a5da71c9b 100644 --- a/packages/autofmt/src/lib.rs +++ b/packages/autofmt/src/lib.rs @@ -118,7 +118,7 @@ pub fn write_block_out(body: CallBody) -> Option { } pub fn fmt_block(block: &str, indent_level: usize) -> Option { - let body = syn::parse_str::(block).unwrap(); + let body = syn::parse_str::(block).ok()?; let mut buf = Buffer { src: block.lines().map(|f| f.to_string()).collect(), diff --git a/packages/rsx/src/node.rs b/packages/rsx/src/node.rs index d7dfbf0d6..ef76d14ff 100644 --- a/packages/rsx/src/node.rs +++ b/packages/rsx/src/node.rs @@ -16,17 +16,6 @@ Parse -> component() -> "text {with_args}" -> (0..10).map(|f| rsx!("asd")), // <--- notice the comma - must be a complete expr --> // some comment here (no support for slash asterisk comments - those get deleted completely) - - - -div { - // Comment - div { // a comment here because it shares the line - - } -} - */ #[derive(PartialEq, Eq, Clone, Debug, Hash)] pub enum BodyNode {