Skip to content

Commit

Permalink
Prepare for rustfmt 2.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Sep 8, 2020
1 parent 8a26c3c commit e62b176
Show file tree
Hide file tree
Showing 51 changed files with 196 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ fn map_to_python_err(py: Python, err: ParseError) -> PyErr {
return PyErr::new::<exceptions::OptionAmbiguous, _>(
py,
(msg, option_name, possibilities),
)
);
}
ParseError::AmbiguousCommand {
command_name,
Expand All @@ -262,10 +262,10 @@ fn map_to_python_err(py: Python, err: ParseError) -> PyErr {
return PyErr::new::<exceptions::AmbiguousCommand, _>(
py,
(msg, command_name, possibilities),
)
);
}
ParseError::CircularReference { command_name } => {
return PyErr::new::<exceptions::CircularReference, _>(py, (msg, command_name))
return PyErr::new::<exceptions::CircularReference, _>(py, (msg, command_name));
}
ParseError::MalformedAlias { name, value } => {
return PyErr::new::<exceptions::MalformedAlias, _>(py, (msg, name, value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn fix_newline(py: Python, hunk: &PyList, a: &PyList, b: &PyList) -> PyResult<us
Some(b'-') => {
a.set_item(py, a.len(py) - 1, to_object(py, &last_line[..]));
}
_ => (),
_ => {}
}
hunk.set_item(py, hunk_len - 1, to_object(py, &last_line));
}
Expand Down
6 changes: 3 additions & 3 deletions eden/scm/edenscmnative/bindings/modules/pyerror/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ fn register_error_handlers() {
match e {
dag::Error::Backend(ref backend_error) => match backend_error.as_ref() {
dag::errors::BackendError::Io(e) => {
return Some(cpython_ext::error::translate_io_error(py, &e))
return Some(cpython_ext::error::translate_io_error(py, &e));
}
dag::errors::BackendError::Other(e) => return specific_error_handler(py, e, m),
_ => (),
_ => {}
},
dag::Error::VertexNotFound(_) | dag::Error::IdNotFound(_) => {
return Some(PyErr::new::<CommitLookupError, _>(
py,
cpython_ext::Str::from(e.to_string()),
));
}
_ => (),
_ => {}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ fn file_metadata_to_py_tuple(
let flag = {
let mut s = String::new();
match file_metadata.file_type {
FileType::Regular => (),
FileType::Regular => {}
FileType::Executable => s.push('x'),
FileType::Symlink => s.push('l'),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl<T: RemoteDataStore + ?Sized> RemoteDataStorePyExt for T {
results.append(py, key_tuple.into_object());
}
StoreKey::Content(_, _) => {
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py)
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<T: HgIdHistoryStore + ?Sized> HgIdHistoryStorePyExt for T {
results.append(py, key_tuple.into_object());
}
StoreKey::Content(_, _) => {
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py)
return Err(format_err!("Unsupported key: {:?}", key)).map_pyerr(py);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fn update(

let meta = match state.store.get_meta(StoreKey::hgid(key))? {
StoreResult::NotFound(key) => {
return Err(format_err!("Can't find metadata for key: {:?}", key))
return Err(format_err!("Can't find metadata for key: {:?}", key));
}
StoreResult::Found(meta) => meta,
};
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/exec/hgmain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn main() {
full_args = debugpython_args;
}
}
_ => (),
_ => {}
}

#[cfg(feature = "with_chg")]
Expand Down
4 changes: 1 addition & 3 deletions eden/scm/lib/async-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ pub static STREAM_BUFFER_SIZE: usize = 128;
///
/// If the async computation panics then the panic gets propagated up. At that point the mutex
/// holding the runtime gets poisoned.
pub fn block_on_future<F: Future>(f: F) -> F::Output
where
{
pub fn block_on_future<F: Future>(f: F) -> F::Output {
// Should be replaced with `runtime.handle().block_on` after updating tokio, see T65261126.
// T73962890 tracks updating this code internally. Externally the issue is tracked under at
// https://github.com/tokio-rs/tokio/issues/2390
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/blackbox/src/blackbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl BlackboxOptions {
push(INDEX_EVENT_TAG_NAME, name.as_bytes());
}
}
_ => (),
_ => {}
}
}
result
Expand Down
10 changes: 9 additions & 1 deletion eden/scm/lib/blackbox/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,15 @@ impl fmt::Display for Event {
write!(
f,
"[network] {:?} finished in {} calls, duration {} ms, latency {} ms, read {} bytes, write {} bytes, session id {}, url {}{}",
op, calls, duration_ms, latency_ms, read_bytes, write_bytes, session_id, url, result,
op,
calls,
duration_ms,
latency_ms,
read_bytes,
write_bytes,
session_id,
url,
result,
)?;
}
Start {
Expand Down
4 changes: 3 additions & 1 deletion eden/scm/lib/clidispatch/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ pub struct UnknownCommand(pub String);
pub struct FallbackToPython;

#[derive(Debug, Error)]
#[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)")]
#[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)"
)]
pub struct RepoRequired(pub String);

#[derive(Debug, Error)]
Expand Down
8 changes: 4 additions & 4 deletions eden/scm/lib/configparser/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl ConfigSet {
};
return handle_value(this, pair, section, name, location);
}
_ => (),
_ => {}
}
}
unreachable!();
Expand Down Expand Up @@ -348,7 +348,7 @@ impl ConfigSet {
match pair.as_rule() {
Rule::include => handle_include(this, pair, errors),
Rule::unset => handle_unset(this, pair, section),
_ => (),
_ => {}
}
}
};
Expand All @@ -366,7 +366,7 @@ impl ConfigSet {
Rule::config_item => handle_config_item(self, pair, section.clone()),
Rule::section => handle_section(pair, &mut section),
Rule::directive => handle_directive(self, pair, &section, errors),
Rule::blank_line | Rule::comment_line | Rule::new_line | Rule::EOI => (),
Rule::blank_line | Rule::comment_line | Rule::new_line | Rule::EOI => {}

Rule::comment_start
| Rule::compound
Expand Down Expand Up @@ -524,7 +524,7 @@ impl ConfigSet {
(None, Some(value)) => {
result.missing.push(((sname.clone(), kname.clone()), value));
}
(None, None) => (),
(None, None) => {}
};

if !removed && super_value.is_some() && super_value != last_value {
Expand Down
4 changes: 2 additions & 2 deletions eden/scm/lib/configparser/src/hg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ impl ConfigSetHgExt for ConfigSet {
let res = generate_dynamicconfig(repo_path, repo_name, None, user_name);
if let Err(e) = res {
match e.downcast_ref::<IOError>() {
Some(io_error) if io_error.kind() == ErrorKind::PermissionDenied => (),
Some(io_error) if io_error.kind() == ErrorKind::PermissionDenied => {}
_ => return Err(e),
};
}
Expand Down Expand Up @@ -716,7 +716,7 @@ fn parse_list_internal(value: &str) -> Vec<String> {
enum State {
Plain,
Quote,
};
}

let mut offset = 0;
let mut parts: Vec<String> = vec![String::new()];
Expand Down
4 changes: 2 additions & 2 deletions eden/scm/lib/dag/src/default_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub(crate) fn beautify(
}
}
Ok(best_branch)
};
}

// Sort heads recursively.
fn sort(
Expand Down Expand Up @@ -135,7 +135,7 @@ pub(crate) fn beautify(
}

Ok(())
};
}

let main_branch = main_branch.unwrap_or_else(NameSet::empty);
let mut heads: Vec<_> = this
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/idmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl IdMap {
let id = Id(entry.read_u64::<BigEndian>().unwrap());
return Ok(Some(id));
}
None => (),
None => {}
Some(Err(err)) => return Err(err.into()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/nameset/difference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl Iterator for Iter {
match self.rhs.contains(&name) {
Err(err) => break Some(Err(err)),
Ok(true) => continue,
_ => (),
_ => {}
}
}
break result;
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/nameset/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl fmt::Debug for Hints {
(Some(min), Some(max)) => write!(f, ", {}..={}", min.0, max.0)?,
(Some(min), None) => write!(f, ", {}..", min.0)?,
(None, Some(max)) => write!(f, ", ..={}", max.0)?,
(None, None) => (),
(None, None) => {}
}
write!(f, ")")?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/nameset/id_lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl fmt::Debug for IdLazySet {
match (remaining, inner.state) {
(0, State::Incomplete) => f.write_str(" + ? more")?,
(n, State::Incomplete) => write!(f, "+ {} + ? more", n)?,
(0, _) => (),
(0, _) => {}
(n, _) => write!(f, " + {} more", n)?,
}
f.write_str(">")?;
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/nameset/id_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl fmt::Debug for IdStaticSet {
}))
.finish()?;
match spans.len().max(limit) - limit {
0 => (),
0 => {}
1 => write!(f, " + 1 span")?,
n => write!(f, " + {} spans", n)?,
}
Expand Down
6 changes: 3 additions & 3 deletions eden/scm/lib/dag/src/nameset/intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl IntersectionSet {
(Some(id1), Some(id2), true) => {
hints.set_min_id(id1.max(id2));
}
(None, Some(_), false) | (None, None, _) => (),
(None, Some(_), false) | (None, None, _) => {}
}
match (lhs.hints().max_id(), rhs.hints().max_id(), compatible) {
(Some(id), None, _) | (Some(id), Some(_), false) | (None, Some(id), true) => {
Expand All @@ -87,7 +87,7 @@ impl IntersectionSet {
(Some(id1), Some(id2), true) => {
hints.set_max_id(id1.min(id2));
}
(None, Some(_), false) | (None, None, _) => (),
(None, Some(_), false) | (None, None, _) => {}
}
Self { lhs, rhs, hints }
}
Expand Down Expand Up @@ -210,7 +210,7 @@ impl Iterator for Iter {
}
continue;
}
Ok(true) => (),
Ok(true) => {}
}
}
break result;
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/nameset/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl fmt::Debug for LazySet {
match (remaining, inner.state) {
(0, State::Incomplete) => f.write_str(" + ? more")?,
(n, State::Incomplete) => write!(f, "+ {} + ? more", n)?,
(0, _) => (),
(0, _) => {}
(n, _) => write!(f, " + {} more", n)?,
}
f.write_str(">")?;
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/dag/src/spanset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Span {
(Excluded(_), _) | (Unbounded, _) | (_, Unbounded) => {
panic!("unsupported bound type")
}
_ => (),
_ => {}
}
}
match (bounds.start_bound(), bounds.end_bound()) {
Expand Down
4 changes: 2 additions & 2 deletions eden/scm/lib/drawdag/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub fn parse(text: impl AsRef<str>) -> BTreeMap<String, BTreeSet<String>> {
return;
}
match (ch, direction) {
(' ', _) => (),
(' ', _) => {}
('|', BottomTop) => {
to_visit.push((y + 1, x - 1, "/"));
to_visit.push((y + 1, x, "|/\\t"));
Expand Down Expand Up @@ -174,7 +174,7 @@ pub fn parse(text: impl AsRef<str>) -> BTreeMap<String, BTreeSet<String>> {
match (ch, direction) {
('-', BottomTop) => panic!("'-' is incompatible with BottomTop direction"),
('|', LeftRight) => panic!("'|' is incompatible with LeftRight direction"),
_ => (),
_ => {}
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions eden/scm/lib/edenfs-client/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,16 +1000,16 @@ I ignored.txt
});

let mardui_color_stdout = concat!(
"\u{001B}[34m\u{001B}[1mM modified.txt\u{001B}[0m\n",
"\u{001B}[32m\u{001B}[1mA added.txt\u{001B}[0m\n",
"\u{001B}[32m\u{001B}[1mA added_even_though_normally_ignored.txt\u{001B}[0m\n",
"\u{001B}[32m\u{001B}[1mA added_other_parent.txt\u{001B}[0m\n",
"\u{001B}[31m\u{001B}[1mR modified_and_marked_for_removal.txt\u{001B}[0m\n",
"\u{001B}[31m\u{001B}[1mR removed.txt\u{001B}[0m\n",
"\u{001B}[36m\u{001B}[1m\u{001b}[4m! removed_but_not_marked_for_removal.txt\u{001B}[0m\n",
"\u{001B}[35m\u{001B}[1m\u{001b}[4m? unknown.txt\u{001B}[0m\n",
"\u{001B}[30;1m\u{001B}[1mI ignored.txt\u{001B}[0m\n",
);
"\u{001B}[34m\u{001B}[1mM modified.txt\u{001B}[0m\n",
"\u{001B}[32m\u{001B}[1mA added.txt\u{001B}[0m\n",
"\u{001B}[32m\u{001B}[1mA added_even_though_normally_ignored.txt\u{001B}[0m\n",
"\u{001B}[32m\u{001B}[1mA added_other_parent.txt\u{001B}[0m\n",
"\u{001B}[31m\u{001B}[1mR modified_and_marked_for_removal.txt\u{001B}[0m\n",
"\u{001B}[31m\u{001B}[1mR removed.txt\u{001B}[0m\n",
"\u{001B}[36m\u{001B}[1m\u{001b}[4m! removed_but_not_marked_for_removal.txt\u{001B}[0m\n",
"\u{001B}[35m\u{001B}[1m\u{001b}[4m? unknown.txt\u{001B}[0m\n",
"\u{001B}[30;1m\u{001B}[1mI ignored.txt\u{001B}[0m\n",
);
test_status(StatusTestCase {
args: vec!["-mardui".to_owned()],
entries: entries.clone(),
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/hgcommands/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn current_dir(io: &mut clidispatch::io::IO) -> io::Result<PathBuf> {
}
}
}
_ => (),
_ => {}
}
}
result
Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/hgcommits/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl GitSegmentedCommits {
bookmarks.push(format!("{} {}\n", vertex.to_hex(), name));
}
}
_ => (),
_ => {}
}
}

Expand Down
2 changes: 1 addition & 1 deletion eden/scm/lib/http_client/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ mod tests {
struct Body<'a> {
foo: &'a str,
hello: &'a str,
};
}

let body = Body {
foo: "bar",
Expand Down
Loading

0 comments on commit e62b176

Please sign in to comment.