diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-05-20 13:20:29 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-05-20 13:20:29 +0000 |
| commit | 8682dfc7a382c1eec5e8ba1bad26665acf376418 (patch) | |
| tree | c3c93f9cf3bdec07187f13c6d1c7a077177fe849 /src/librustdoc/html/layout.rs | |
| parent | 7a68021dfce68f4e3a5edde8d93dee34dda68aa4 (diff) | |
| download | rust-8682dfc7a382c1eec5e8ba1bad26665acf376418.tar.gz rust-8682dfc7a382c1eec5e8ba1bad26665acf376418.zip | |
Get rid of unnecessary `BufDisplay` abstraction
Diffstat (limited to 'src/librustdoc/html/layout.rs')
| -rw-r--r-- | src/librustdoc/html/layout.rs | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 44b3be23914..3b5f9b5a458 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -1,4 +1,4 @@ -use std::fmt::{self, Display}; +use std::fmt::Display; use std::path::PathBuf; use askama::Template; @@ -71,23 +71,6 @@ struct PageLayout<'a> { pub(crate) use crate::html::render::sidebar::filters; -/// Implements [`Display`] for a function that accepts a mutable reference to a [`String`], and (optionally) writes to it. -/// -/// The wrapped function will receive an empty string, and can modify it, -/// and the `Display` implementation will write the contents of the string after the function has finished. -pub(crate) struct BufDisplay<F>(pub F); - -impl<F> Display for BufDisplay<F> -where - F: Fn(&mut String), -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut buf = String::new(); - self.0(&mut buf); - f.write_str(&buf) - } -} - pub(crate) fn render<T: Display, S: Display>( layout: &Layout, page: &Page<'_>, |
