diff --git a/maud/src/lib.rs b/maud/src/lib.rs index 52223b7..02e1386 100644 --- a/maud/src/lib.rs +++ b/maud/src/lib.rs @@ -76,16 +76,17 @@ pub trait Render { } } -#[cfg(feature = "unstable")] +#[cfg(not(feature = "unstable"))] impl<T: fmt::Display + ?Sized> Render for T { - default fn render_to(&self, w: &mut String) { + fn render_to(&self, w: &mut String) { let _ = write!(Escaper::new(w), "{}", self); } } -impl<T: AsRef<str>> Render for PreEscaped<T> { - fn render_to(&self, w: &mut String) { - w.push_str(self.0.as_ref()); +#[cfg(feature = "unstable")] +impl<T: fmt::Display + ?Sized> Render for T { + default fn render_to(&self, w: &mut String) { + let _ = write!(Escaper::new(w), "{}", self); } } @@ -103,17 +104,16 @@ impl Render for str { } } -#[cfg(not(feature = "unstable"))] -impl<T: fmt::Display + ?Sized> Render for T { - fn render_to(&self, w: &mut String) { - let _ = write!(Escaper::new(w), "{}", self); - } -} - /// A wrapper that renders the inner value without escaping. #[derive(Debug, Clone, Copy)] pub struct PreEscaped<T: AsRef<str>>(pub T); +impl<T: AsRef<str>> Render for PreEscaped<T> { + fn render_to(&self, w: &mut String) { + w.push_str(self.0.as_ref()); + } +} + /// A block of markup is a string that does not need to be escaped. /// /// The `html!` macro expands to an expression of this type.