Skip to content

Commit 3eaa4de

Browse files
committed
Implement HtmlSafe for all reference wrappers
1 parent a9bf11b commit 3eaa4de

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

rinja/src/filters/escape.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,6 @@ mark_html_safe! {
466466
std::num::NonZeroU64, std::num::NonZeroU128, std::num::NonZeroUsize,
467467
}
468468

469-
impl<T: HtmlSafe + ?Sized> HtmlSafe for &T {}
470-
impl<T: HtmlSafe + ?Sized> HtmlSafe for Box<T> {}
471-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::cell::Ref<'_, T> {}
472-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::cell::RefMut<'_, T> {}
473-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::rc::Rc<T> {}
474-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::pin::Pin<&T> {}
475-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::sync::Arc<T> {}
476-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::sync::MutexGuard<'_, T> {}
477-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::sync::RwLockReadGuard<'_, T> {}
478-
impl<T: HtmlSafe + ?Sized> HtmlSafe for std::sync::RwLockWriteGuard<'_, T> {}
479469
impl<T: HtmlSafe> HtmlSafe for std::num::Wrapping<T> {}
480470
impl<T: fmt::Display> HtmlSafe for HtmlSafeOutput<T> {}
481471

@@ -486,6 +476,12 @@ where
486476
{
487477
}
488478

479+
crate::impl_for_ref! {
480+
impl HtmlSafe for T {}
481+
}
482+
483+
impl<T: HtmlSafe> HtmlSafe for Pin<T> {}
484+
489485
/// Used internally by rinja to select the appropriate [`write!()`] mechanism
490486
pub struct Writable<'a, S: ?Sized>(pub &'a S);
491487

0 commit comments

Comments
 (0)