Function clang_format::clang_format
source · pub fn clang_format(input: &str) -> Result<String, impl Error>
Expand description
Execute clang-format with the given input and collect the output
Note that this uses ClangFormatStyle::Default
as the style.
Example
let input = r#"
struct Test {
};
"#;
let output = clang_format(input);
assert!(output.is_ok());
assert_eq!(output.unwrap(), "\nstruct Test {};\n");