File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1+ # When updating, also update `rust_format::Config` in `node/build.rs`
12indent_style = " Block"
23imports_granularity = " Crate"
34reorder_imports = true
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ use std::{
1010} ;
1111
1212use regex:: Regex ;
13- use rust_format:: Formatter ;
13+ use rust_format:: { Edition , Formatter } ;
1414
1515fn visit_dirs ( dir : & PathBuf , cb : & mut dyn FnMut ( & DirEntry ) ) -> io:: Result < ( ) > {
1616 if dir. is_dir ( ) {
@@ -355,7 +355,15 @@ fn main() -> Result<(), Box<dyn Error>> {
355355
356356 let tmp_path = PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) . join ( "action_kind.rs" ) ;
357357 fs:: write ( & tmp_path, contents) ?;
358- rust_format:: RustFmt :: default ( )
358+
359+ // This should be same as `.rustfmt.toml`
360+ let config = rust_format:: Config :: new_str ( )
361+ . edition ( Edition :: Rust2021 )
362+ . option ( "indent_style" , "Block" )
363+ . option ( "imports_granularity" , "Crate" )
364+ . option ( "reorder_imports" , "true" ) ;
365+
366+ rust_format:: RustFmt :: from_config ( config)
359367 . format_file ( & tmp_path)
360368 . expect ( "failed to format generated file" ) ;
361369
You can’t perform that action at this time.
0 commit comments