Skip to content

Commit be0786f

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: StanislavGlebik Differential Revision: D23568780 fbshipit-source-id: b4b4a0aa683d236e2fdeb5b96d723ac2d84b9faf
1 parent bf8a8c4 commit be0786f

File tree

77 files changed

+436
-379
lines changed

Some content is hidden

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

77 files changed

+436
-379
lines changed

eden/mononoke/blobrepo/blobrepo_hg/src/bonsai_generation.rs

+49-47
Original file line numberDiff line numberDiff line change
@@ -106,57 +106,59 @@ fn find_file_changes(
106106
cs.manifestid(),
107107
parent_manifests.iter().cloned().collect(),
108108
)
109-
.map(move |changed_file| match changed_file {
110-
BonsaiDiffFileChange::Changed(path, ty, entry_id) => {
111-
let file_node_id = HgFileNodeId::new(entry_id.into_nodehash());
112-
cloned!(ctx, bonsai_parents, repo, parent_manifests);
113-
file_node_id
114-
.load(ctx.clone(), repo.blobstore())
115-
.compat()
116-
.from_err()
117-
.and_then(move |envelope| {
118-
let size = envelope.content_size();
119-
let content_id = envelope.content_id();
120-
121-
get_copy_info(
122-
ctx,
123-
repo,
124-
bonsai_parents,
125-
path.clone(),
126-
envelope,
127-
parent_manifests,
128-
)
129-
.context("While fetching copy information")
109+
.map(move |changed_file| {
110+
match changed_file {
111+
BonsaiDiffFileChange::Changed(path, ty, entry_id) => {
112+
let file_node_id = HgFileNodeId::new(entry_id.into_nodehash());
113+
cloned!(ctx, bonsai_parents, repo, parent_manifests);
114+
file_node_id
115+
.load(ctx.clone(), repo.blobstore())
116+
.compat()
130117
.from_err()
131-
.map(move |copyinfo| {
132-
(
133-
path,
134-
Some(FileChange::new(content_id, ty, size as u64, copyinfo)),
118+
.and_then(move |envelope| {
119+
let size = envelope.content_size();
120+
let content_id = envelope.content_id();
121+
122+
get_copy_info(
123+
ctx,
124+
repo,
125+
bonsai_parents,
126+
path.clone(),
127+
envelope,
128+
parent_manifests,
135129
)
130+
.context("While fetching copy information")
131+
.from_err()
132+
.map(move |copyinfo| {
133+
(
134+
path,
135+
Some(FileChange::new(content_id, ty, size as u64, copyinfo)),
136+
)
137+
})
136138
})
137-
})
138-
.boxify()
139-
}
140-
BonsaiDiffFileChange::ChangedReusedId(path, ty, entry_id) => {
141-
let file_node_id = HgFileNodeId::new(entry_id.into_nodehash());
142-
cloned!(ctx, repo);
143-
file_node_id
144-
.load(ctx, repo.blobstore())
145-
.compat()
146-
.from_err()
147-
.and_then(move |envelope| {
148-
let size = envelope.content_size();
149-
let content_id = envelope.content_id();
150-
151-
// Reused ID means copy info is *not* stored.
152-
Ok((
153-
path,
154-
Some(FileChange::new(content_id, ty, size as u64, None)),
155-
))
156-
})
157-
.boxify()
139+
.boxify()
140+
}
141+
BonsaiDiffFileChange::ChangedReusedId(path, ty, entry_id) => {
142+
let file_node_id = HgFileNodeId::new(entry_id.into_nodehash());
143+
cloned!(ctx, repo);
144+
file_node_id
145+
.load(ctx, repo.blobstore())
146+
.compat()
147+
.from_err()
148+
.and_then(move |envelope| {
149+
let size = envelope.content_size();
150+
let content_id = envelope.content_id();
151+
152+
// Reused ID means copy info is *not* stored.
153+
Ok((
154+
path,
155+
Some(FileChange::new(content_id, ty, size as u64, None)),
156+
))
157+
})
158+
.boxify()
159+
}
160+
BonsaiDiffFileChange::Deleted(path) => Ok((path, None)).into_future().boxify(),
158161
}
159-
BonsaiDiffFileChange::Deleted(path) => Ok((path, None)).into_future().boxify(),
160162
})
161163
.buffer_unordered(100) // TODO(stash): magic number?
162164
.collect()

eden/mononoke/blobrepo/blobrepo_hg/src/derive_hg_changeset.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub fn check_case_conflict_in_manifest(
234234
potential_conflicts.extend(path);
235235
}
236236
}
237-
_ => (),
237+
_ => {}
238238
}
239239
}
240240

eden/mononoke/blobrepo/blobrepo_hg/src/derive_hg_manifest.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,20 @@ pub fn derive_hg_manifest(
6161
move |leaf_info, _sender| create_hg_file(ctx.clone(), blobstore.clone(), leaf_info)
6262
},
6363
)
64-
.and_then(move |tree_id| match tree_id {
65-
Some(traced_tree_id) => future::ok(traced_tree_id.into_untraced()).left_future(),
66-
None => {
67-
// All files have been deleted, generate empty **root** manifest
68-
let tree_info = TreeInfo {
69-
path: None,
70-
parents,
71-
subentries: Default::default(),
72-
};
73-
create_hg_manifest(ctx, blobstore, None, tree_info)
74-
.map(|(_, traced_tree_id)| traced_tree_id.into_untraced())
75-
.right_future()
64+
.and_then(move |tree_id| {
65+
match tree_id {
66+
Some(traced_tree_id) => future::ok(traced_tree_id.into_untraced()).left_future(),
67+
None => {
68+
// All files have been deleted, generate empty **root** manifest
69+
let tree_info = TreeInfo {
70+
path: None,
71+
parents,
72+
subentries: Default::default(),
73+
};
74+
create_hg_manifest(ctx, blobstore, None, tree_info)
75+
.map(|(_, traced_tree_id)| traced_tree_id.into_untraced())
76+
.right_future()
77+
}
7678
}
7779
})
7880
}

eden/mononoke/blobrepo/blobsync/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn copy_content(
6565
"File not found for fetch key: {:?}",
6666
fetch_key
6767
))
68-
.left_future()
68+
.left_future();
6969
}
7070
};
7171

@@ -76,7 +76,7 @@ pub fn copy_content(
7676
"File not found for fetch key: {:?}",
7777
fetch_key
7878
))
79-
.left_future()
79+
.left_future();
8080
}
8181
Some(byte_stream) => {
8282
ok((store_request, byte_stream)).right_future()

eden/mononoke/blobrepo/errors/src/lib.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,21 @@ pub enum ErrorKind {
114114
BonsaiMappingNotFound(HgChangesetId),
115115
#[error("Root path wasn't expected at this context")]
116116
UnexpectedRootPath,
117-
#[error("Incorrect copy info: not found a file version {from_path} {from_node} the file {to_path} {to_node} was copied from")]
117+
#[error(
118+
"Incorrect copy info: not found a file version {from_path} {from_node} the file {to_path} {to_node} was copied from"
119+
)]
118120
IncorrectCopyInfo {
119121
from_path: MPath,
120122
from_node: HgFileNodeId,
121123
to_path: MPath,
122124
to_node: HgFileNodeId,
123125
},
124-
#[error("CaseConflict: the changes introduced by this commit have conflicting case. The first offending path is '{0}'. Resolve the conflict.")]
126+
#[error(
127+
"CaseConflict: the changes introduced by this commit have conflicting case. The first offending path is '{0}'. Resolve the conflict."
128+
)]
125129
InternalCaseConflict(MPath),
126-
#[error("CaseConflict: the changes introduced by this commit conflict with existing files in the repository. The first conflicting path in this commit was '{0}', and conflicted with '{1}' in the repository. Resolve the conflict.")]
130+
#[error(
131+
"CaseConflict: the changes introduced by this commit conflict with existing files in the repository. The first conflicting path in this commit was '{0}', and conflicted with '{1}' in the repository. Resolve the conflict."
132+
)]
127133
ExternalCaseConflict(MPath, MPath),
128134
}

eden/mononoke/blobstore/cacheblob/src/memcache_cache_lease.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,8 @@ impl LeaseOps for MemcacheOps {
347347
// This future checks the state of the lease, and releases it only
348348
// if it's locked by us right now.
349349
let f = future::lazy(move || {
350-
memcache
351-
.get(mc_key.clone())
352-
.and_then(move |maybe_data| match maybe_data {
350+
memcache.get(mc_key.clone()).and_then(move |maybe_data| {
351+
match maybe_data {
353352
Some(bytes) => {
354353
let state: Result<LockState, Error> =
355354
compact_protocol::deserialize(Vec::from(bytes));
@@ -399,7 +398,8 @@ impl LeaseOps for MemcacheOps {
399398
LEASE_STATS::release_no_lease.add_value(1, (lease_type,));
400399
future::ok(()).right_future()
401400
}
402-
})
401+
}
402+
})
403403
});
404404
// We don't have to wait for the releasing to finish, it can be done in background
405405
// because leases have a timeout. So even if they haven't been released explicitly they

eden/mononoke/blobstore/multiplexedblob/src/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ async fn blobstore_get(
292292
(blobstore_id, Err(error)) => {
293293
errors.insert(blobstore_id, error);
294294
}
295-
(_, Ok(None)) => (),
295+
(_, Ok(None)) => {}
296296
}
297297
}
298298

@@ -545,7 +545,7 @@ impl Blobstore for MultiplexedBlobstoreBase {
545545
(blobstore_id, Err(error)) => {
546546
errors.insert(blobstore_id, error);
547547
}
548-
(_, Ok(false)) => (),
548+
(_, Ok(false)) => {}
549549
}
550550
}
551551
if errors.is_empty() {

eden/mononoke/blobstore/multiplexedblob/src/scrub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async fn blobstore_get(
213213
needs_repair.insert(*k, s.as_ref());
214214
}
215215
}
216-
None => (),
216+
None => {}
217217
}
218218
}
219219
if scrub_action == ScrubAction::ReportOnly {

eden/mononoke/blobstore/packblob/src/pack.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ pub fn decode_pack(
8888
return Err(format_err!(
8989
"Unexpected PackedValue::Single on key {}",
9090
&key
91-
))
91+
));
9292
}
9393
PackedValue::ZstdFromDict(v) => {
94-
return Ok(decode_zstd_from_dict(pack_meta, &key, v, possible_dicts)?)
94+
return Ok(decode_zstd_from_dict(pack_meta, &key, v, possible_dicts)?);
9595
}
9696
PackedValue::UnknownField(e) => {
97-
return Err(format_err!("PackedValue::UnknownField {:?}", e))
97+
return Err(format_err!("PackedValue::UnknownField {:?}", e));
9898
}
9999
}
100100
}

eden/mononoke/blobstore/packblob/src/store.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<T: Blobstore + Clone> Blobstore for PackBlob<T> {
8989
StorageFormat::Packed(packed) => pack::decode_pack(meta, packed, key.clone())
9090
.with_context(|| format!("While decoding pack for {:?}", key))?,
9191
StorageFormat::UnknownField(e) => {
92-
return Err(format_err!("StorageFormat::UnknownField {:?}", e))
92+
return Err(format_err!("StorageFormat::UnknownField {:?}", e));
9393
}
9494
};
9595

eden/mononoke/blobstore/redactedblobstore/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ pub fn has_redaction_root_cause(e: &Error) -> bool {
247247

248248
#[cfg(test)]
249249
mod test {
250-
251250
use super::*;
252251
use assert_matches::assert_matches;
253252
use context::CoreContext;

eden/mononoke/bonsai_git_mapping/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl BonsaiGitMapping for SqlBonsaiGitMapping {
282282

283283
for entry in entries.iter() {
284284
match mapping_from_db.get(&entry.git_sha1) {
285-
Some(bcs_id) if bcs_id == &entry.bcs_id => (), // We've tried to insert a duplicate, proceed.
285+
Some(bcs_id) if bcs_id == &entry.bcs_id => {} // We've tried to insert a duplicate, proceed.
286286
_ => {
287287
return Err(AddGitMappingErrorKind::Conflict(vec![entry.clone()].into()));
288288
} // A real conflict!

eden/mononoke/bookmarks/dbbookmarks/src/transaction.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl SqlBookmarksTransactionPayload {
194194
return Err(anyhow!(
195195
"FindMaxBookmarkLogId returned multiple entries: {:?}",
196196
max_id_entries
197-
))
197+
));
198198
}
199199
};
200200
Ok((txn, next_id))
@@ -542,7 +542,7 @@ impl BookmarkTransaction for SqlBookmarksTransaction {
542542
Err(BookmarkTransactionError::RetryableError(_))
543543
if attempt < MAX_BOOKMARK_TRANSACTION_ATTEMPT_COUNT =>
544544
{
545-
continue
545+
continue;
546546
}
547547
err => break err,
548548
};
@@ -551,7 +551,7 @@ impl BookmarkTransaction for SqlBookmarksTransaction {
551551
Err(BookmarkTransactionError::RetryableError(_))
552552
if attempt < MAX_BOOKMARK_TRANSACTION_ATTEMPT_COUNT =>
553553
{
554-
continue
554+
continue;
555555
}
556556
result => break result,
557557
}

eden/mononoke/changesets/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ fn select_many_changesets(
607607

608608
#[cfg(test)]
609609
mod tests {
610-
611610
use super::*;
612611

613612
#[test]

eden/mononoke/cmds/admin/blobstore_fetch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub async fn subcommand_blobstore_fetch<'a>(
258258
FileContents::from_encoded_bytes(value.into_raw_bytes())
259259
),
260260
Some("git-tree") => display::<GitTree>(&value.try_into()),
261-
_ => (),
261+
_ => {}
262262
}
263263
}
264264
}

0 commit comments

Comments
 (0)