From 2bc11f8fb73dc52a1961659994ac62e2c5d83e09 Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Sun, 5 Mar 2023 18:15:58 +0100 Subject: [PATCH] Remove log! and error! macros --- src/shortcuts.rs | 49 -------------------------------------- src/virtual_dom/node/el.rs | 4 ++-- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/shortcuts.rs b/src/shortcuts.rs index 04595599..f73fe1fa 100644 --- a/src/shortcuts.rs +++ b/src/shortcuts.rs @@ -4,7 +4,6 @@ // @TODO merge with `pub use` & `prelude` in `lib.rs` and `browser::util`? use crate::virtual_dom::{At, Attrs}; -use std::fmt; /// Allows to write nested macros. /// @@ -488,54 +487,6 @@ macro_rules! nodes { }; } -pub const fn wrap_debug(object: T) -> T -where - T: fmt::Debug, -{ - object -} - -/// A convenience function for logging to the web browser's console. We use -/// a macro to supplement the log function to allow multiple inputs. -#[macro_export] -#[deprecated(note = "Use something like https://crates.io/crates/gloo-console instead")] -macro_rules! log { - { $($expr:expr),* $(,)? } => { - { - let mut formatted_exprs = Vec::new(); - $( - formatted_exprs.push(format!("{:#?}", $crate::shortcuts::wrap_debug(&$expr))); - )* - $crate::shortcuts::log_1( - &formatted_exprs - .as_slice() - .join(" ") - .into() - ); - } - }; -} - -/// Similar to log! -#[macro_export] -#[deprecated(note = "Use something like https://crates.io/crates/gloo-console instead")] -macro_rules! error { - { $($expr:expr),* $(,)? } => { - { - let mut formatted_exprs = Vec::new(); - $( - formatted_exprs.push(format!("{:#?}", $crate::shortcuts::wrap_debug(&$expr))); - )* - web_sys::console::error_1( - &formatted_exprs - .as_slice() - .join(" ") - .into() - ); - } - }; -} - /// A key-value pairs, where the keys and values must implement `ToString`. #[macro_export] macro_rules! key_value_pairs { diff --git a/src/virtual_dom/node/el.rs b/src/virtual_dom/node/el.rs index 34880159..e7429ac6 100644 --- a/src/virtual_dom/node/el.rs +++ b/src/virtual_dom/node/el.rs @@ -277,8 +277,8 @@ impl El { _ => false, }; if script_found { - error!("Script tag found inside mount point! \ - Please check https://docs.rs/seed/latest/seed/app/builder/struct.Builder.html#examples"); + web_sys::console::error_1(&wasm_bindgen::JsValue::from("Script tag found inside mount point! \ + Please check https://docs.rs/seed/latest/seed/app/builder/struct.Builder.html#examples")); } for child in &self.children {