Skip to content

Commit e62b176

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: zertosh Differential Revision: D23568779 fbshipit-source-id: 477200f35b280a4f6471d8e574e37e5f57917baf
1 parent 8a26c3c commit e62b176

File tree

51 files changed

+196
-177
lines changed

Some content is hidden

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

51 files changed

+196
-177
lines changed

eden/scm/edenscmnative/bindings/modules/pycliparser/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ fn map_to_python_err(py: Python, err: ParseError) -> PyErr {
253253
return PyErr::new::<exceptions::OptionAmbiguous, _>(
254254
py,
255255
(msg, option_name, possibilities),
256-
)
256+
);
257257
}
258258
ParseError::AmbiguousCommand {
259259
command_name,
@@ -262,10 +262,10 @@ fn map_to_python_err(py: Python, err: ParseError) -> PyErr {
262262
return PyErr::new::<exceptions::AmbiguousCommand, _>(
263263
py,
264264
(msg, command_name, possibilities),
265-
)
265+
);
266266
}
267267
ParseError::CircularReference { command_name } => {
268-
return PyErr::new::<exceptions::CircularReference, _>(py, (msg, command_name))
268+
return PyErr::new::<exceptions::CircularReference, _>(py, (msg, command_name));
269269
}
270270
ParseError::MalformedAlias { name, value } => {
271271
return PyErr::new::<exceptions::MalformedAlias, _>(py, (msg, name, value));

eden/scm/edenscmnative/bindings/modules/pydiffhelpers/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn fix_newline(py: Python, hunk: &PyList, a: &PyList, b: &PyList) -> PyResult<us
116116
Some(b'-') => {
117117
a.set_item(py, a.len(py) - 1, to_object(py, &last_line[..]));
118118
}
119-
_ => (),
119+
_ => {}
120120
}
121121
hunk.set_item(py, hunk_len - 1, to_object(py, &last_line));
122122
}

eden/scm/edenscmnative/bindings/modules/pyerror/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,18 @@ fn register_error_handlers() {
101101
match e {
102102
dag::Error::Backend(ref backend_error) => match backend_error.as_ref() {
103103
dag::errors::BackendError::Io(e) => {
104-
return Some(cpython_ext::error::translate_io_error(py, &e))
104+
return Some(cpython_ext::error::translate_io_error(py, &e));
105105
}
106106
dag::errors::BackendError::Other(e) => return specific_error_handler(py, e, m),
107-
_ => (),
107+
_ => {}
108108
},
109109
dag::Error::VertexNotFound(_) | dag::Error::IdNotFound(_) => {
110110
return Some(PyErr::new::<CommitLookupError, _>(
111111
py,
112112
cpython_ext::Str::from(e.to_string()),
113113
));
114114
}
115-
_ => (),
115+
_ => {}
116116
}
117117
}
118118

eden/scm/edenscmnative/bindings/modules/pymanifest/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ fn file_metadata_to_py_tuple(
562562
let flag = {
563563
let mut s = String::new();
564564
match file_metadata.file_type {
565-
FileType::Regular => (),
565+
FileType::Regular => {}
566566
FileType::Executable => s.push('x'),
567567
FileType::Symlink => s.push('l'),
568568
};

eden/scm/edenscmnative/bindings/modules/pyrevisionstore/src/datastorepyext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl<T: RemoteDataStore + ?Sized> RemoteDataStorePyExt for T {
304304
results.append(py, key_tuple.into_object());
305305
}
306306
StoreKey::Content(_, _) => {
307-
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py)
307+
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py);
308308
}
309309
}
310310
}

eden/scm/edenscmnative/bindings/modules/pyrevisionstore/src/historystorepyext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<T: HgIdHistoryStore + ?Sized> HgIdHistoryStorePyExt for T {
6969
results.append(py, key_tuple.into_object());
7070
}
7171
StoreKey::Content(_, _) => {
72-
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py)
72+
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py);
7373
}
7474
}
7575
}

eden/scm/edenscmnative/bindings/modules/pyworker/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn update(
156156

157157
let meta = match state.store.get_meta(StoreKey::hgid(key))? {
158158
StoreResult::NotFound(key) => {
159-
return Err(format_err!("Can't find metadata for key: {:?}", key))
159+
return Err(format_err!("Can't find metadata for key: {:?}", key));
160160
}
161161
StoreResult::Found(meta) => meta,
162162
};

eden/scm/exec/hgmain/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn main() {
5555
full_args = debugpython_args;
5656
}
5757
}
58-
_ => (),
58+
_ => {}
5959
}
6060

6161
#[cfg(feature = "with_chg")]

eden/scm/lib/async-runtime/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ pub static STREAM_BUFFER_SIZE: usize = 128;
4646
///
4747
/// If the async computation panics then the panic gets propagated up. At that point the mutex
4848
/// holding the runtime gets poisoned.
49-
pub fn block_on_future<F: Future>(f: F) -> F::Output
50-
where
51-
{
49+
pub fn block_on_future<F: Future>(f: F) -> F::Output {
5250
// Should be replaced with `runtime.handle().block_on` after updating tokio, see T65261126.
5351
// T73962890 tracks updating this code internally. Externally the issue is tracked under at
5452
// https://github.com/tokio-rs/tokio/issues/2390

eden/scm/lib/blackbox/src/blackbox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl BlackboxOptions {
160160
push(INDEX_EVENT_TAG_NAME, name.as_bytes());
161161
}
162162
}
163-
_ => (),
163+
_ => {}
164164
}
165165
}
166166
result

eden/scm/lib/blackbox/src/event.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,15 @@ impl fmt::Display for Event {
685685
write!(
686686
f,
687687
"[network] {:?} finished in {} calls, duration {} ms, latency {} ms, read {} bytes, write {} bytes, session id {}, url {}{}",
688-
op, calls, duration_ms, latency_ms, read_bytes, write_bytes, session_id, url, result,
688+
op,
689+
calls,
690+
duration_ms,
691+
latency_ms,
692+
read_bytes,
693+
write_bytes,
694+
session_id,
695+
url,
696+
result,
689697
)?;
690698
}
691699
Start {

eden/scm/lib/clidispatch/src/errors.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ pub struct UnknownCommand(pub String);
2929
pub struct FallbackToPython;
3030

3131
#[derive(Debug, Error)]
32-
#[error("'{0}' is not inside a repository, but this command requires a repository!\n(use 'cd' to go to a directory inside a repository and try again)")]
32+
#[error(
33+
"'{0}' is not inside a repository, but this command requires a repository!\n(use 'cd' to go to a directory inside a repository and try again)"
34+
)]
3335
pub struct RepoRequired(pub String);
3436

3537
#[derive(Debug, Error)]

eden/scm/lib/configparser/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl ConfigSet {
293293
};
294294
return handle_value(this, pair, section, name, location);
295295
}
296-
_ => (),
296+
_ => {}
297297
}
298298
}
299299
unreachable!();
@@ -348,7 +348,7 @@ impl ConfigSet {
348348
match pair.as_rule() {
349349
Rule::include => handle_include(this, pair, errors),
350350
Rule::unset => handle_unset(this, pair, section),
351-
_ => (),
351+
_ => {}
352352
}
353353
}
354354
};
@@ -366,7 +366,7 @@ impl ConfigSet {
366366
Rule::config_item => handle_config_item(self, pair, section.clone()),
367367
Rule::section => handle_section(pair, &mut section),
368368
Rule::directive => handle_directive(self, pair, &section, errors),
369-
Rule::blank_line | Rule::comment_line | Rule::new_line | Rule::EOI => (),
369+
Rule::blank_line | Rule::comment_line | Rule::new_line | Rule::EOI => {}
370370

371371
Rule::comment_start
372372
| Rule::compound
@@ -524,7 +524,7 @@ impl ConfigSet {
524524
(None, Some(value)) => {
525525
result.missing.push(((sname.clone(), kname.clone()), value));
526526
}
527-
(None, None) => (),
527+
(None, None) => {}
528528
};
529529

530530
if !removed && super_value.is_some() && super_value != last_value {

eden/scm/lib/configparser/src/hg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl ConfigSetHgExt for ConfigSet {
364364
let res = generate_dynamicconfig(repo_path, repo_name, None, user_name);
365365
if let Err(e) = res {
366366
match e.downcast_ref::<IOError>() {
367-
Some(io_error) if io_error.kind() == ErrorKind::PermissionDenied => (),
367+
Some(io_error) if io_error.kind() == ErrorKind::PermissionDenied => {}
368368
_ => return Err(e),
369369
};
370370
}
@@ -716,7 +716,7 @@ fn parse_list_internal(value: &str) -> Vec<String> {
716716
enum State {
717717
Plain,
718718
Quote,
719-
};
719+
}
720720

721721
let mut offset = 0;
722722
let mut parts: Vec<String> = vec![String::new()];

eden/scm/lib/dag/src/default_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub(crate) fn beautify(
9595
}
9696
}
9797
Ok(best_branch)
98-
};
98+
}
9999

100100
// Sort heads recursively.
101101
fn sort(
@@ -135,7 +135,7 @@ pub(crate) fn beautify(
135135
}
136136

137137
Ok(())
138-
};
138+
}
139139

140140
let main_branch = main_branch.unwrap_or_else(NameSet::empty);
141141
let mut heads: Vec<_> = this

eden/scm/lib/dag/src/idmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl IdMap {
220220
let id = Id(entry.read_u64::<BigEndian>().unwrap());
221221
return Ok(Some(id));
222222
}
223-
None => (),
223+
None => {}
224224
Some(Err(err)) => return Err(err.into()),
225225
}
226226
}

eden/scm/lib/dag/src/nameset/difference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl Iterator for Iter {
9898
match self.rhs.contains(&name) {
9999
Err(err) => break Some(Err(err)),
100100
Ok(true) => continue,
101-
_ => (),
101+
_ => {}
102102
}
103103
}
104104
break result;

eden/scm/lib/dag/src/nameset/hints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl fmt::Debug for Hints {
229229
(Some(min), Some(max)) => write!(f, ", {}..={}", min.0, max.0)?,
230230
(Some(min), None) => write!(f, ", {}..", min.0)?,
231231
(None, Some(max)) => write!(f, ", ..={}", max.0)?,
232-
(None, None) => (),
232+
(None, None) => {}
233233
}
234234
write!(f, ")")?;
235235
Ok(())

eden/scm/lib/dag/src/nameset/id_lazy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl fmt::Debug for IdLazySet {
144144
match (remaining, inner.state) {
145145
(0, State::Incomplete) => f.write_str(" + ? more")?,
146146
(n, State::Incomplete) => write!(f, "+ {} + ? more", n)?,
147-
(0, _) => (),
147+
(0, _) => {}
148148
(n, _) => write!(f, " + {} more", n)?,
149149
}
150150
f.write_str(">")?;

eden/scm/lib/dag/src/nameset/id_static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl fmt::Debug for IdStaticSet {
9494
}))
9595
.finish()?;
9696
match spans.len().max(limit) - limit {
97-
0 => (),
97+
0 => {}
9898
1 => write!(f, " + 1 span")?,
9999
n => write!(f, " + {} spans", n)?,
100100
}

eden/scm/lib/dag/src/nameset/intersection.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl IntersectionSet {
7878
(Some(id1), Some(id2), true) => {
7979
hints.set_min_id(id1.max(id2));
8080
}
81-
(None, Some(_), false) | (None, None, _) => (),
81+
(None, Some(_), false) | (None, None, _) => {}
8282
}
8383
match (lhs.hints().max_id(), rhs.hints().max_id(), compatible) {
8484
(Some(id), None, _) | (Some(id), Some(_), false) | (None, Some(id), true) => {
@@ -87,7 +87,7 @@ impl IntersectionSet {
8787
(Some(id1), Some(id2), true) => {
8888
hints.set_max_id(id1.min(id2));
8989
}
90-
(None, Some(_), false) | (None, None, _) => (),
90+
(None, Some(_), false) | (None, None, _) => {}
9191
}
9292
Self { lhs, rhs, hints }
9393
}
@@ -210,7 +210,7 @@ impl Iterator for Iter {
210210
}
211211
continue;
212212
}
213-
Ok(true) => (),
213+
Ok(true) => {}
214214
}
215215
}
216216
break result;

eden/scm/lib/dag/src/nameset/lazy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl fmt::Debug for LazySet {
105105
match (remaining, inner.state) {
106106
(0, State::Incomplete) => f.write_str(" + ? more")?,
107107
(n, State::Incomplete) => write!(f, "+ {} + ? more", n)?,
108-
(0, _) => (),
108+
(0, _) => {}
109109
(n, _) => write!(f, " + {} more", n)?,
110110
}
111111
f.write_str(">")?;

eden/scm/lib/dag/src/spanset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Span {
100100
(Excluded(_), _) | (Unbounded, _) | (_, Unbounded) => {
101101
panic!("unsupported bound type")
102102
}
103-
_ => (),
103+
_ => {}
104104
}
105105
}
106106
match (bounds.start_bound(), bounds.end_bound()) {

eden/scm/lib/drawdag/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub fn parse(text: impl AsRef<str>) -> BTreeMap<String, BTreeSet<String>> {
111111
return;
112112
}
113113
match (ch, direction) {
114-
(' ', _) => (),
114+
(' ', _) => {}
115115
('|', BottomTop) => {
116116
to_visit.push((y + 1, x - 1, "/"));
117117
to_visit.push((y + 1, x, "|/\\t"));
@@ -174,7 +174,7 @@ pub fn parse(text: impl AsRef<str>) -> BTreeMap<String, BTreeSet<String>> {
174174
match (ch, direction) {
175175
('-', BottomTop) => panic!("'-' is incompatible with BottomTop direction"),
176176
('|', LeftRight) => panic!("'|' is incompatible with LeftRight direction"),
177-
_ => (),
177+
_ => {}
178178
}
179179
}
180180
}

eden/scm/lib/edenfs-client/src/status.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,16 +1000,16 @@ I ignored.txt
10001000
});
10011001

10021002
let mardui_color_stdout = concat!(
1003-
"\u{001B}[34m\u{001B}[1mM modified.txt\u{001B}[0m\n",
1004-
"\u{001B}[32m\u{001B}[1mA added.txt\u{001B}[0m\n",
1005-
"\u{001B}[32m\u{001B}[1mA added_even_though_normally_ignored.txt\u{001B}[0m\n",
1006-
"\u{001B}[32m\u{001B}[1mA added_other_parent.txt\u{001B}[0m\n",
1007-
"\u{001B}[31m\u{001B}[1mR modified_and_marked_for_removal.txt\u{001B}[0m\n",
1008-
"\u{001B}[31m\u{001B}[1mR removed.txt\u{001B}[0m\n",
1009-
"\u{001B}[36m\u{001B}[1m\u{001b}[4m! removed_but_not_marked_for_removal.txt\u{001B}[0m\n",
1010-
"\u{001B}[35m\u{001B}[1m\u{001b}[4m? unknown.txt\u{001B}[0m\n",
1011-
"\u{001B}[30;1m\u{001B}[1mI ignored.txt\u{001B}[0m\n",
1012-
);
1003+
"\u{001B}[34m\u{001B}[1mM modified.txt\u{001B}[0m\n",
1004+
"\u{001B}[32m\u{001B}[1mA added.txt\u{001B}[0m\n",
1005+
"\u{001B}[32m\u{001B}[1mA added_even_though_normally_ignored.txt\u{001B}[0m\n",
1006+
"\u{001B}[32m\u{001B}[1mA added_other_parent.txt\u{001B}[0m\n",
1007+
"\u{001B}[31m\u{001B}[1mR modified_and_marked_for_removal.txt\u{001B}[0m\n",
1008+
"\u{001B}[31m\u{001B}[1mR removed.txt\u{001B}[0m\n",
1009+
"\u{001B}[36m\u{001B}[1m\u{001b}[4m! removed_but_not_marked_for_removal.txt\u{001B}[0m\n",
1010+
"\u{001B}[35m\u{001B}[1m\u{001b}[4m? unknown.txt\u{001B}[0m\n",
1011+
"\u{001B}[30;1m\u{001B}[1mI ignored.txt\u{001B}[0m\n",
1012+
);
10131013
test_status(StatusTestCase {
10141014
args: vec!["-mardui".to_owned()],
10151015
entries: entries.clone(),

eden/scm/lib/hgcommands/src/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn current_dir(io: &mut clidispatch::io::IO) -> io::Result<PathBuf> {
152152
}
153153
}
154154
}
155-
_ => (),
155+
_ => {}
156156
}
157157
}
158158
result

eden/scm/lib/hgcommits/src/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl GitSegmentedCommits {
8080
bookmarks.push(format!("{} {}\n", vertex.to_hex(), name));
8181
}
8282
}
83-
_ => (),
83+
_ => {}
8484
}
8585
}
8686

eden/scm/lib/http_client/src/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ mod tests {
499499
struct Body<'a> {
500500
foo: &'a str,
501501
hello: &'a str,
502-
};
502+
}
503503

504504
let body = Body {
505505
foo: "bar",

0 commit comments

Comments
 (0)