Skip to content

Commit f8cbe80

Browse files
David Tolnayfacebook-github-bot
David Tolnay
authored andcommitted
Prepare for rustfmt 2.0
Summary: Generated by formatting with rustfmt 2.0.0-rc.2 and then a second time with fbsource's current rustfmt (1.4.14). This results in formatting for which rustfmt 1.4 is idempotent but is closer to the style of rustfmt 2.0, reducing the amount of code that will need to change atomically in that upgrade. --- *Why now?* **:** The 1.x branch is no longer being developed and fixes like rust-lang/rustfmt#4159 (which we need in fbcode) only land to the 2.0 branch. --- Reviewed By: shiqicao Differential Revision: D23568783 fbshipit-source-id: ccac998bb5edb272b16e9b0b1ad2339e60dad21a
1 parent aae266e commit f8cbe80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+279
-272
lines changed

hphp/hack/src/decl/direct_decl_smart_constructors.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a> DirectDeclSmartConstructors<'a> {
8484
let mut qualified_name =
8585
String::with_capacity_in(namespace.len() + parts.len() * 10, this.state.arena);
8686
match parts.first() {
87-
Some(Node::Backslash(_)) => (), // Already fully-qualified
87+
Some(Node::Backslash(_)) => {} // Already fully-qualified
8888
_ => qualified_name.push_str(namespace),
8989
}
9090
for part in parts {
@@ -279,7 +279,7 @@ fn read_member_modifiers<'a: 'b, 'b>(modifiers: impl Iterator<Item = &'b Node<'a
279279
Node::Token(TokenKind::Static) => ret.is_static = true,
280280
Node::Token(TokenKind::Abstract) => ret.is_abstract = true,
281281
Node::Token(TokenKind::Final) => ret.is_final = true,
282-
_ => (),
282+
_ => {}
283283
}
284284
}
285285
ret
@@ -427,7 +427,7 @@ impl<'a> ClassishNameBuilder<'a> {
427427
class_name.push_str(name);
428428
*self = InClassish(arena.alloc((class_name.into_bump_str(), pos, token_kind)))
429429
}
430-
InClassish(_) => (),
430+
InClassish(_) => {}
431431
}
432432
}
433433

@@ -864,7 +864,7 @@ impl<'a> Node<'a> {
864864
arena.alloc(Ty_::Tapply(arena.alloc((class_name, &[][..])))),
865865
));
866866
}
867-
_ => (),
867+
_ => {}
868868
}
869869
}
870870

@@ -936,7 +936,7 @@ impl<'a> Node<'a> {
936936
"__ReturnDisposable" => {
937937
attributes.returns_disposable = true;
938938
}
939-
_ => (),
939+
_ => {}
940940
}
941941
} else {
942942
panic!("Expected an attribute, but was {:?}", self);
@@ -1799,7 +1799,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
17991799

18001800
// We only want to check the mode if <? is the very first token we see.
18011801
match (&self.state.file_mode_builder, &kind) {
1802-
(FileModeBuilder::None, TokenKind::Markup) => (),
1802+
(FileModeBuilder::None, TokenKind::Markup) => {}
18031803
(FileModeBuilder::None, TokenKind::LessThanQuestion) => {
18041804
self.state.file_mode_builder = FileModeBuilder::Pending
18051805
}
@@ -1814,7 +1814,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
18141814
Mode::Mstrict
18151815
});
18161816
}
1817-
(_, _) => (),
1817+
(_, _) => {}
18181818
}
18191819

18201820
let result = match kind {
@@ -2289,7 +2289,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
22892289

22902290
match (&op, rhs) {
22912291
(Bop::Eq(_), Node::Token(TokenKind::Yield)) => return rhs,
2292-
_ => (),
2292+
_ => {}
22932293
}
22942294

22952295
let pos = unwrap_or_return!(Pos::merge(
@@ -2893,7 +2893,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
28932893
match modifier {
28942894
Node::Token(TokenKind::Abstract) => class_kind = ClassKind::Cabstract,
28952895
Node::Token(TokenKind::Final) => final_ = true,
2896-
_ => (),
2896+
_ => {}
28972897
}
28982898
}
28992899

@@ -2923,7 +2923,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
29232923
for attribute in attributes.iter() {
29242924
match attribute {
29252925
&Node::Attribute(..) => user_attributes_len += 1,
2926-
_ => (),
2926+
_ => {}
29272927
}
29282928
}
29292929

@@ -2961,7 +2961,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
29612961
methods_len += 1
29622962
}
29632963
}
2964-
_ => (),
2964+
_ => {}
29652965
}
29662966
}
29672967

@@ -2982,7 +2982,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
29822982
for attribute in attributes.iter() {
29832983
match attribute {
29842984
Node::Attribute(attr) => user_attributes.push(self.user_attribute_to_decl(&attr)),
2985-
_ => (),
2985+
_ => {}
29862986
}
29872987
}
29882988
// Match ordering of attributes produced by the OCaml decl parser (even
@@ -3041,7 +3041,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
30413041
methods.push(method.clone());
30423042
}
30433043
}
3044-
_ => (), // It's not our job to report errors here.
3044+
_ => {} // It's not our job to report errors here.
30453045
}
30463046
}
30473047

@@ -3381,7 +3381,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
33813381
for attribute in attributes.iter() {
33823382
match attribute {
33833383
Node::Attribute(attr) => user_attributes.push(self.user_attribute_to_decl(attr)),
3384-
_ => (),
3384+
_ => {}
33853385
}
33863386
}
33873387
// Match ordering of attributes produced by the OCaml decl parser (even
@@ -3800,7 +3800,7 @@ impl<'a> FlattenSmartConstructors<'a, State<'a>> for DirectDeclSmartConstructors
38003800
fold_string_concat(&e1, acc);
38013801
fold_string_concat(&e2, acc);
38023802
}
3803-
_ => (),
3803+
_ => {}
38043804
}
38053805
}
38063806

hphp/hack/src/facts/facts_parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn typenames_from_list(list: Node, namespace: &str, names: &mut StringSet, names
143143
names.insert(name);
144144
}
145145
}),
146-
_ => (),
146+
_ => {}
147147
};
148148
}
149149

@@ -416,7 +416,7 @@ fn collect(mut acc: CollectAcc, node: Node) -> CollectAcc {
416416
FileAttributeSpecification(attributes) => {
417417
acc.1.file_attributes = attributes_into_facts(&acc.0, *attributes);
418418
}
419-
_ => (),
419+
_ => {}
420420
};
421421
acc
422422
}

hphp/hack/src/facts/facts_smart_constructors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<'a> FlattenSmartConstructors<'a, HasScriptContent<'a>> for FactsSmartConstr
337337
}
338338
}
339339
}
340-
_ => (),
340+
_ => {}
341341
};
342342
Node::Ignored
343343
}

hphp/hack/src/hhbc/ast_constant_folder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn shape_to_typed_value(
278278
return Err(Error::unrecoverable(format!(
279279
"{} is not a valid integer index",
280280
s
281-
)))
281+
)));
282282
}
283283
}
284284
}

hphp/hack/src/hhbc/ast_scope.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'a> Scope<'a> {
6060
ScopeItem::Method(md) => {
6161
return md.get_span().clone();
6262
}
63-
_ => (),
63+
_ => {}
6464
}
6565
}
6666
Pos::make_none()
@@ -84,7 +84,7 @@ impl<'a> Scope<'a> {
8484
ScopeItem::Method(md) => {
8585
extend_shallowly(md.get_tparams());
8686
}
87-
_ => (),
87+
_ => {}
8888
}
8989
}
9090
tparams
@@ -102,7 +102,7 @@ impl<'a> Scope<'a> {
102102
ScopeItem::Method(md) => {
103103
return md.get_tparams();
104104
}
105-
_ => (),
105+
_ => {}
106106
}
107107
}
108108
&[]
@@ -130,7 +130,7 @@ impl<'a> Scope<'a> {
130130
ScopeItem::Method(_) => {
131131
return true;
132132
}
133-
_ => (),
133+
_ => {}
134134
}
135135
}
136136
false
@@ -150,7 +150,7 @@ impl<'a> Scope<'a> {
150150
let fun_kind = f.get_fun_kind();
151151
return fun_kind == FunKind::FAsync || fun_kind == FunKind::FAsyncGenerator;
152152
}
153-
_ => (),
153+
_ => {}
154154
}
155155
}
156156
false
@@ -171,7 +171,7 @@ impl<'a> Scope<'a> {
171171
return false;
172172
}
173173
}
174-
ScopeItem::Lambda(_) => (),
174+
ScopeItem::Lambda(_) => {}
175175
_ => return false,
176176
}
177177
}
@@ -203,7 +203,7 @@ impl<'a> Scope<'a> {
203203
}) => {
204204
return *rl;
205205
}
206-
_ => (),
206+
_ => {}
207207
}
208208
}
209209
rx::Level::NonRx
@@ -219,7 +219,7 @@ impl<'a> Scope<'a> {
219219
ScopeItem::Function(f) => {
220220
return has(f.get_user_attributes());
221221
}
222-
_ => (),
222+
_ => {}
223223
}
224224
}
225225
false

hphp/hack/src/hhbc/closure_convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn make_scope_name(ns: &RcOc<namespace_env::Env>, scope: &ast_scope::Scope) -> S
441441
parts.push("::".into())
442442
};
443443
}
444-
_ => (),
444+
_ => {}
445445
}
446446
}
447447
parts.reverse();

hphp/hack/src/hhbc/emit_adata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn rewrite_typed_value(e: &mut Emitter, instr: &mut Instruct) -> Result<()> {
7272
return Err(Error::Unrecoverable(format!(
7373
"Unknown HhasAdata data: {}",
7474
d
75-
)))
75+
)));
7676
}
7777
}
7878
}

hphp/hack/src/hhbc/emit_body.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn make_decl_vars(
350350
} else {
351351
match &scope.items[..] {
352352
[] | [.., ScopeItem::Class(_), _] => move_this(&mut decl_vars),
353-
_ => (),
353+
_ => {}
354354
};
355355
decl_vars
356356
};
@@ -491,7 +491,7 @@ fn emit_defs(env: &mut Env, emitter: &mut Emitter, prog: &[tast::Def]) -> Result
491491
Def::Namespace(ns) => emit_defs(env, emitter, &ns.1),
492492
_ => Ok(instr::empty()),
493493
}
494-
};
494+
}
495495
fn aux(env: &mut Env, emitter: &mut Emitter, defs: &[tast::Def]) -> Result {
496496
match defs {
497497
[Def::SetNamespaceEnv(ns), ..] => {
@@ -515,7 +515,7 @@ fn emit_defs(env: &mut Env, emitter: &mut Emitter, prog: &[tast::Def]) -> Result
515515
aux(env, emitter, &defs[1..])?,
516516
])),
517517
}
518-
};
518+
}
519519
match prog {
520520
[Def::Stmt(s), ..] if s.1.is_markup() => Ok(InstrSeq::gather(vec![
521521
emit_statement::emit_markup(emitter, env, s.1.as_markup().unwrap(), true)?,

hphp/hack/src/hhbc/emit_class.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,11 @@ fn emit_reified_extends_params<'a>(
308308
&l.iter().collect::<Vec<_>>(),
309309
)?,
310310
instr::record_reified_generic(),
311-
]))
311+
]));
312312
}
313-
_ => (),
313+
_ => {}
314314
},
315-
_ => (),
315+
_ => {}
316316
}
317317
let hack_arr_dv_arr_mark = e
318318
.options()

0 commit comments

Comments
 (0)