",
- match tooltip {
- Tooltip::Ignore => " ignore",
- Tooltip::CompileFail => " compile_fail",
- Tooltip::ShouldPanic => " should_panic",
- Tooltip::Edition(_) => " edition",
- Tooltip::None => "",
- },
+ format_args!(
+ "
",
+ match tooltip {
+ Tooltip::Ignore => " ignore",
+ Tooltip::CompileFail => " compile_fail",
+ Tooltip::ShouldPanic => " should_panic",
+ Tooltip::Edition(_) => " edition",
+ Tooltip::None => "",
+ }
+ ),
);
if tooltip != Tooltip::None {
let edition_code;
- write!(
+ write_str(
out,
- "
ⓘ",
- match tooltip {
- Tooltip::Ignore => "This example is not tested",
- Tooltip::CompileFail => "This example deliberately fails to compile",
- Tooltip::ShouldPanic => "This example panics",
- Tooltip::Edition(edition) => {
- edition_code = format!("This example runs with edition {edition}");
- &edition_code
+ format_args!(
+ "
ⓘ",
+ match tooltip {
+ Tooltip::Ignore => "This example is not tested",
+ Tooltip::CompileFail => "This example deliberately fails to compile",
+ Tooltip::ShouldPanic => "This example panics",
+ Tooltip::Edition(edition) => {
+ edition_code = format!("This example runs with edition {edition}");
+ &edition_code
+ }
+ Tooltip::None => unreachable!(),
}
- Tooltip::None => unreachable!(),
- },
+ ),
);
}
if let Some(extra) = extra_content {
- out.push_buffer(extra);
+ out.push_str(&extra);
}
if class.is_empty() {
- write!(
+ write_str(
out,
- "
",
- if extra_classes.is_empty() { "" } else { " " },
- extra_classes.join(" "),
+ format_args!(
+ "",
+ if extra_classes.is_empty() { "" } else { " " },
+ extra_classes.join(" ")
+ ),
);
} else {
- write!(
+ write_str(
out,
- "",
- if extra_classes.is_empty() { "" } else { " " },
- extra_classes.join(" "),
+ format_args!(
+ "",
+ if extra_classes.is_empty() { "" } else { " " },
+ extra_classes.join(" ")
+ ),
);
}
- write!(out, "");
+ write_str(out, format_args!(""));
}
/// Check if two `Class` can be merged together. In the following rules, "unclassified" means `None`
@@ -398,8 +406,8 @@ pub(super) fn write_code(
});
}
-fn write_footer(out: &mut Buffer, playground_button: Option<&str>) {
- writeln!(out, "
{}
", playground_button.unwrap_or_default());
+fn write_footer(out: &mut String, playground_button: Option<&str>) {
+ write_str(out, format_args_nl!("{}