Implement From conversion for style detector-to-generator (#1678)

This commit is contained in:
Charlie Marsh
2023-01-05 21:47:48 -05:00
committed by GitHub
parent 8caa73df6a
commit fe67a0d239
15 changed files with 38 additions and 116 deletions

View File

@@ -22,11 +22,7 @@ pub fn main(cli: &Cli) -> Result<()> {
let python_ast = parser::parse_program(&contents, &cli.file.to_string_lossy())?;
let locator = SourceCodeLocator::new(&contents);
let stylist = SourceCodeStyleDetector::from_contents(&contents, &locator);
let mut generator = SourceCodeGenerator::new(
stylist.indentation(),
stylist.quote(),
stylist.line_ending(),
);
let mut generator: SourceCodeGenerator = (&stylist).into();
generator.unparse_suite(&python_ast);
println!("{}", generator.generate());
Ok(())