Skip to content

Commit 9e77ccc

Browse files
authored
chore: standardize rustfmt config (#574)
1 parent 175cb13 commit 9e77ccc

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

.rustfmt.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
style_edition = "2024"
2+
use_small_heuristics = "Max"
3+
use_field_init_shorthand = true
4+
reorder_modules = true
5+
merge_derives = true
6+
remove_nested_parens = true

benches/parser.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ trait TheBencher {
1616
fn bench(g: &mut BenchmarkGroup<'_, WallTime>, path: &Path, source: &str) {
1717
let cpus = num_cpus::get_physical();
1818
let id = BenchmarkId::new(Self::ID, "single-thread");
19-
g.bench_with_input(id, &source, |b, source| {
20-
b.iter(|| Self::parse(path, source))
21-
});
19+
g.bench_with_input(id, &source, |b, source| b.iter(|| Self::parse(path, source)));
2220

2321
let id = BenchmarkId::new(Self::ID, "no-drop");
2422
g.bench_with_input(id, &source, |b, source| {

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ pub mod swc {
2121
pub fn parse(path: &Path, source: &str) -> Module {
2222
let syntax = match path.extension().unwrap().to_str().unwrap() {
2323
"js" => Syntax::Es(EsSyntax::default()),
24-
"tsx" => Syntax::Typescript(TsSyntax {
25-
tsx: true,
26-
..TsSyntax::default()
27-
}),
24+
"tsx" => Syntax::Typescript(TsSyntax { tsx: true, ..TsSyntax::default() }),
2825
_ => panic!("need to define syntax for swc"),
2926
};
3027
let input = StringInput::new(source, BytePos(0), BytePos(source.len() as u32));

0 commit comments

Comments
 (0)