diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-02-09 18:24:52 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-02-12 15:50:06 +0000 |
| commit | d99d8c249d3c965ab8a006dfe10a46214395682d (patch) | |
| tree | d298b8eb9f43bd778f291d100139a94b60b72c7b /src/librustdoc/html/highlight/tests.rs | |
| parent | 552a959051cebf8f88a8f558399baf733bec9ce0 (diff) | |
| download | rust-d99d8c249d3c965ab8a006dfe10a46214395682d.tar.gz rust-d99d8c249d3c965ab8a006dfe10a46214395682d.zip | |
Nuke `Buffer` abstraction from `librustdoc` 💣
Diffstat (limited to 'src/librustdoc/html/highlight/tests.rs')
| -rw-r--r-- | src/librustdoc/html/highlight/tests.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index 8f39130bb83..2603e887bea 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -3,7 +3,6 @@ use rustc_data_structures::fx::FxIndexMap; use rustc_span::create_default_session_globals_then; use super::{DecorationInfo, write_code}; -use crate::html::format::Buffer; const STYLE: &str = r#" <style> @@ -22,9 +21,9 @@ fn test_html_highlighting() { create_default_session_globals_then(|| { let src = include_str!("fixtures/sample.rs"); let html = { - let mut out = Buffer::new(); + let mut out = String::new(); write_code(&mut out, src, None, None, None); - format!("{STYLE}<pre><code>{}</code></pre>\n", out.into_inner()) + format!("{STYLE}<pre><code>{out}</code></pre>\n") }; expect_file!["fixtures/sample.html"].assert_eq(&html); }); @@ -36,9 +35,9 @@ fn test_dos_backline() { let src = "pub fn foo() {\r\n\ println!(\"foo\");\r\n\ }\r\n"; - let mut html = Buffer::new(); + let mut html = String::new(); write_code(&mut html, src, None, None, None); - expect_file!["fixtures/dos_line.html"].assert_eq(&html.into_inner()); + expect_file!["fixtures/dos_line.html"].assert_eq(&html); }); } @@ -50,9 +49,9 @@ use self::whatever; let x = super::b::foo; let y = Self::whatever;"; - let mut html = Buffer::new(); + let mut html = String::new(); write_code(&mut html, src, None, None, None); - expect_file!["fixtures/highlight.html"].assert_eq(&html.into_inner()); + expect_file!["fixtures/highlight.html"].assert_eq(&html); }); } @@ -60,9 +59,9 @@ let y = Self::whatever;"; fn test_union_highlighting() { create_default_session_globals_then(|| { let src = include_str!("fixtures/union.rs"); - let mut html = Buffer::new(); + let mut html = String::new(); write_code(&mut html, src, None, None, None); - expect_file!["fixtures/union.html"].assert_eq(&html.into_inner()); + expect_file!["fixtures/union.html"].assert_eq(&html); }); } @@ -77,8 +76,8 @@ let a = 4;"; decorations.insert("example", vec![(0, 10), (11, 21)]); decorations.insert("example2", vec![(22, 32)]); - let mut html = Buffer::new(); + let mut html = String::new(); write_code(&mut html, src, None, Some(&DecorationInfo(decorations)), None); - expect_file!["fixtures/decorations.html"].assert_eq(&html.into_inner()); + expect_file!["fixtures/decorations.html"].assert_eq(&html); }); } |
