rustfmt_nightly

Function format_code_block

source
pub(crate) fn format_code_block(
    code_snippet: &str,
    config: &Config,
    is_macro_def: bool,
) -> Option<FormattedSnippet>
Expand description

Format the given code block. Mainly targeted for code block in comment. The code block may be incomplete (i.e., parser may be unable to parse it). To avoid panic in parser, we wrap the code block with a dummy function. The returned code block does not end with newline.