about summary refs log tree commit diff
path: root/src/librustdoc/html/sources.rs
diff options
context:
space:
mode:
authorYotam Ofek <yotam.ofek@gmail.com>2025-01-14 12:17:44 +0000
committerYotam Ofek <yotam.ofek@gmail.com>2025-01-22 05:13:52 +0000
commit1dee842c92a9977d19740511726dca8fa591c272 (patch)
tree1286f355084ae9505c041323235210333ec617c0 /src/librustdoc/html/sources.rs
parent73fc7af716d614eb88cff01017ac56e700d03aaa (diff)
downloadrust-1dee842c92a9977d19740511726dca8fa591c272.tar.gz
rust-1dee842c92a9977d19740511726dca8fa591c272.zip
rustdoc: use std's (unstable) `fmt::from_fn` instead of open-coding it
Diffstat (limited to 'src/librustdoc/html/sources.rs')
-rw-r--r--src/librustdoc/html/sources.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index d13822b7b62..1ac0c10c612 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -17,7 +17,7 @@ use crate::clean::utils::has_doc_flag;
 use crate::docfs::PathError;
 use crate::error::Error;
 use crate::html::render::Context;
-use crate::html::{format, highlight, layout};
+use crate::html::{highlight, layout};
 use crate::visit::DocVisitor;
 
 pub(crate) fn render(cx: &mut Context<'_>, krate: &clean::Crate) -> Result<(), Error> {
@@ -331,10 +331,10 @@ pub(crate) fn print_src(
     decoration_info: &highlight::DecorationInfo,
     source_context: SourceContext<'_>,
 ) {
-    let current_href = context
-        .href_from_span(clean::Span::new(file_span), false)
-        .expect("only local crates should have sources emitted");
-    let code = format::display_fn(move |fmt| {
+    let code = fmt::from_fn(move |fmt| {
+        let current_href = context
+            .href_from_span(clean::Span::new(file_span), false)
+            .expect("only local crates should have sources emitted");
         highlight::write_code(
             fmt,
             s,