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: D23568786

fbshipit-source-id: e9beea000c76f0683b8e817ee198eed88e5737f1
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Sep 8, 2020
1 parent d303bcf commit fd5be89
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion shed/futures_ext/src/stream_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
for tx in &mut self.senders {
match tx.poll_complete() {
Err(_) => return Err(()),
Ok(Async::Ready(())) => (),
Ok(Async::Ready(())) => {}
Ok(Async::NotReady) => {
done = false;
}
Expand Down
26 changes: 13 additions & 13 deletions shed/netstring/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"hello" => (),
Ok(Some(ref res)) if res.as_ref() == b"hello" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -207,15 +207,15 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"hello" => (),
Ok(Some(ref res)) if res.as_ref() == b"hello" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
),
}

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"world" => (),
Ok(Some(ref res)) if res.as_ref() == b"world" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -232,15 +232,15 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"" => (),
Ok(Some(ref res)) if res.as_ref() == b"" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
),
}

match codec.decode(&mut buf) {
Ok(None) => (),
Ok(None) => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -256,7 +256,7 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(None) => (),
Ok(None) => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -266,7 +266,7 @@ mod test {
buf.put_slice(b"2:hello, world,");

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => (),
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -282,7 +282,7 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(None) => (),
Ok(None) => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -292,7 +292,7 @@ mod test {
buf.put_slice(b":hello, world,");

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => (),
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -308,7 +308,7 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(None) => (),
Ok(None) => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -318,7 +318,7 @@ mod test {
buf.put_slice(b" world,");

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => (),
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -334,7 +334,7 @@ mod test {
let mut codec = NetstringDecoder::default();

match codec.decode(&mut buf) {
Ok(None) => (),
Ok(None) => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand All @@ -344,7 +344,7 @@ mod test {
buf.put_slice(b",");

match codec.decode(&mut buf) {
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => (),
Ok(Some(ref res)) if res.as_ref() == b"hello, world" => {}
bad => panic!(
"decode failed: {:?}",
bad.as_ref().map(|x| x.as_ref().map(BytesMut::as_ref))
Expand Down
2 changes: 1 addition & 1 deletion shed/panichandler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn handler(panic: &PanicInfo<'_>, fate: Fate) {
let _ = w.into_inner();

match fate {
Fate::Continue => (),
Fate::Continue => {}
Fate::Exit(exit) => {
#[cfg(unix)]
unsafe {
Expand Down
1 change: 0 additions & 1 deletion shed/sorted_vector_map/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,6 @@ macro_rules! sorted_vector_map {

#[cfg(test)]
mod tests {

use super::*;
use quickcheck::quickcheck;
use std::collections::BTreeMap;
Expand Down
1 change: 0 additions & 1 deletion shed/sorted_vector_map/src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ macro_rules! sorted_vector_set {

#[cfg(test)]
mod tests {

use super::*;
use quickcheck::quickcheck;
use std::collections::BTreeSet;
Expand Down
2 changes: 1 addition & 1 deletion shed/sql/common/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl Drop for Transaction {
);
}
}
Transaction::Mysql(_) => (),
Transaction::Mysql(_) => {}
}
}
}
8 changes: 4 additions & 4 deletions shed/stats/src/thread_local_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ mod tests {
let _lock = TEST_MUTEX.lock().expect("poisoned lock");

match schedule_stats_aggregation() {
Ok(_) => (),
Ok(_) => {}
Err(err) => panic!("Scheduler is not Ok. Reason: {:?}", err),
}

match schedule_stats_aggregation() {
Ok(_) => panic!("Scheduler should already be initialized"),
Err(StatsScheduledError(_)) => (),
Err(StatsScheduledError(_)) => {}
}

STATS_SCHEDULED.swap(false, atomic::Ordering::AcqRel);
Expand All @@ -221,13 +221,13 @@ mod tests {
let _lock = TEST_MUTEX.lock().expect("poisoned lock");

match schedule_stats_aggregation_preview() {
Ok(_) => (),
Ok(_) => {}
Err(err) => panic!("Scheduler is not Ok. Reason: {:?}", err),
}

match schedule_stats_aggregation_preview() {
Ok(_) => panic!("Scheduler should already be initialized"),
Err(StatsScheduledErrorPreview(_)) => (),
Err(StatsScheduledErrorPreview(_)) => {}
}

STATS_SCHEDULED.swap(false, atomic::Ordering::AcqRel);
Expand Down
2 changes: 1 addition & 1 deletion shed/thrift_compiler/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn run_thrift(

match option_env!("TEST_THRIFT") {
Some(thrift_bin) if env::var("THRIFT").is_err() => env::set_var("THRIFT", thrift_bin),
_ => (),
_ => {}
}

Config::from_env().context("Failed to create thrift compiler")?
Expand Down

0 comments on commit fd5be89

Please sign in to comment.