mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 02:04:19 +00:00
style: use bool::then()
This commit is contained in:
parent
034a23f4ec
commit
9846bf6c7f
3 changed files with 4 additions and 15 deletions
|
@ -553,11 +553,8 @@ impl<'a> RemoteCallbacks<'a> {
|
||||||
if let Some(progress_cb) = self.progress {
|
if let Some(progress_cb) = self.progress {
|
||||||
callbacks.transfer_progress(move |progress| {
|
callbacks.transfer_progress(move |progress| {
|
||||||
progress_cb(&Progress {
|
progress_cb(&Progress {
|
||||||
bytes_downloaded: if progress.received_objects() < progress.total_objects() {
|
bytes_downloaded: (progress.received_objects() < progress.total_objects())
|
||||||
Some(progress.received_bytes() as u64)
|
.then(|| progress.received_bytes() as u64),
|
||||||
} else {
|
|
||||||
None
|
|
||||||
},
|
|
||||||
overall: (progress.indexed_objects() + progress.indexed_deltas()) as f32
|
overall: (progress.indexed_objects() + progress.indexed_deltas()) as f32
|
||||||
/ (progress.total_objects() + progress.total_deltas()) as f32,
|
/ (progress.total_objects() + progress.total_deltas()) as f32,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1240,11 +1240,7 @@ impl IndexSegment for ReadonlyIndex {
|
||||||
fn segment_commit_id_to_pos(&self, commit_id: &CommitId) -> Option<IndexPosition> {
|
fn segment_commit_id_to_pos(&self, commit_id: &CommitId) -> Option<IndexPosition> {
|
||||||
let lookup_pos = self.commit_id_byte_prefix_to_lookup_pos(commit_id)?;
|
let lookup_pos = self.commit_id_byte_prefix_to_lookup_pos(commit_id)?;
|
||||||
let entry = self.lookup_entry(lookup_pos);
|
let entry = self.lookup_entry(lookup_pos);
|
||||||
if &entry.commit_id() == commit_id {
|
(&entry.commit_id() == commit_id).then(|| entry.pos())
|
||||||
Some(entry.pos())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn segment_resolve_prefix(&self, prefix: &HexPrefix) -> PrefixResolution<CommitId> {
|
fn segment_resolve_prefix(&self, prefix: &HexPrefix) -> PrefixResolution<CommitId> {
|
||||||
|
|
|
@ -495,11 +495,7 @@ impl TreeState {
|
||||||
.file_states
|
.file_states
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|(path, state)| {
|
.filter_map(|(path, state)| {
|
||||||
if state.file_type != FileType::GitSubmodule {
|
(state.file_type != FileType::GitSubmodule).then(|| path.clone())
|
||||||
Some(path.clone())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
while let Some((dir, disk_dir, git_ignore)) = work.pop() {
|
while let Some((dir, disk_dir, git_ignore)) = work.pop() {
|
||||||
|
|
Loading…
Reference in a new issue