forked from mirrors/jj
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 {
|
||||
callbacks.transfer_progress(move |progress| {
|
||||
progress_cb(&Progress {
|
||||
bytes_downloaded: if progress.received_objects() < progress.total_objects() {
|
||||
Some(progress.received_bytes() as u64)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
bytes_downloaded: (progress.received_objects() < progress.total_objects())
|
||||
.then(|| progress.received_bytes() as u64),
|
||||
overall: (progress.indexed_objects() + progress.indexed_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> {
|
||||
let lookup_pos = self.commit_id_byte_prefix_to_lookup_pos(commit_id)?;
|
||||
let entry = self.lookup_entry(lookup_pos);
|
||||
if &entry.commit_id() == commit_id {
|
||||
Some(entry.pos())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
(&entry.commit_id() == commit_id).then(|| entry.pos())
|
||||
}
|
||||
|
||||
fn segment_resolve_prefix(&self, prefix: &HexPrefix) -> PrefixResolution<CommitId> {
|
||||
|
|
|
@ -495,11 +495,7 @@ impl TreeState {
|
|||
.file_states
|
||||
.iter()
|
||||
.filter_map(|(path, state)| {
|
||||
if state.file_type != FileType::GitSubmodule {
|
||||
Some(path.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
(state.file_type != FileType::GitSubmodule).then(|| path.clone())
|
||||
})
|
||||
.collect();
|
||||
while let Some((dir, disk_dir, git_ignore)) = work.pop() {
|
||||
|
|
Loading…
Reference in a new issue