+210
-166
lines changedFilter options
+210
-166
lines changed Original file line number Diff line number Diff line change
@@ -44,8 +44,8 @@ pub fn estimate_hours(
44
44
};
45
45
46
46
let author = &commits[0].1;
47
-
let (files, lines) = (!stats.is_empty())
48
-
.then(|| {
47
+
let (files, lines) = if !stats.is_empty() {
48
+
{
49
49
commits
50
50
.iter()
51
51
.map(|t| &t.0)
@@ -60,8 +60,10 @@ pub fn estimate_hours(
60
60
}
61
61
Err(_) => acc,
62
62
})
63
-
})
64
-
.unwrap_or_default();
63
+
}
64
+
} else {
65
+
Default::default()
66
+
};
65
67
WorkByEmail {
66
68
name: author.name,
67
69
email: author.email,
Original file line number Diff line number Diff line change
@@ -113,8 +113,8 @@ where
113
113
Ok(out)
114
114
});
115
115
116
-
let (stats_progresses, stats_counters) = needs_stats
117
-
.then(|| {
116
+
let (stats_progresses, stats_counters) = if needs_stats {
117
+
{
118
118
let mut sp = progress.add_child("extract stats");
119
119
sp.init(None, progress::count("commits"));
120
120
let sc = sp.counter();
@@ -128,14 +128,16 @@ where
128
128
let lc = lp.counter();
129
129
130
130
(Some((sp, cp, lp)), Some((sc, cc, lc)))
131
-
})
132
-
.unwrap_or_default();
131
+
}
132
+
} else {
133
+
Default::default()
134
+
};
133
135
134
136
let mut progress = progress.add_child("traverse commit graph");
135
137
progress.init(None, progress::count("commits"));
136
138
137
-
let (tx_tree_id, stat_threads) = needs_stats
138
-
.then(|| {
139
+
let (tx_tree_id, stat_threads) = if needs_stats {
140
+
{
139
141
let (tx, threads) = spawn_tree_delta_threads(
140
142
scope,
141
143
threads,
@@ -144,8 +146,10 @@ where
144
146
stats_counters.clone().expect("counters are set"),
145
147
);
146
148
(Some(tx), threads)
147
-
})
148
-
.unwrap_or_default();
149
+
}
150
+
} else {
151
+
Default::default()
152
+
};
149
153
150
154
let mut commit_idx = 0_u32;
151
155
let mut skipped_merge_commits = 0;
@@ -296,7 +300,7 @@ where
296
300
total_hours,
297
301
total_hours / HOURS_PER_WORKDAY,
298
302
total_commits,
299
-
is_shallow.then_some(" (shallow)").unwrap_or_default(),
303
+
if is_shallow { " (shallow)" } else { Default::default() },
300
304
num_authors
301
305
)?;
302
306
if file_stats {
Original file line number Diff line number Diff line change
@@ -115,17 +115,18 @@ pub fn checkout_exclusive(
115
115
progress.done(format!(
116
116
"Created {} {} files{} ({})",
117
117
files_updated,
118
-
no_repo.then_some("empty").unwrap_or_default(),
119
-
should_interrupt
120
-
.load(Ordering::Relaxed)
121
-
.then(|| {
118
+
if no_repo { "empty" } else { Default::default() },
119
+
if should_interrupt.load(Ordering::Relaxed) {
120
+
{
122
121
format!(
123
122
" of {}",
124
123
entries_for_checkout
125
124
.saturating_sub(errors.len() + collisions.len() + delayed_paths_unprocessed.len())
126
125
)
127
-
})
128
-
.unwrap_or_default(),
126
+
}
127
+
} else {
128
+
Default::default()
129
+
},
129
130
gix::progress::bytes()
130
131
.unwrap()
131
132
.display(bytes_written as usize, None, None)
Original file line number Diff line number Diff line change
@@ -237,7 +237,7 @@ pub(crate) mod function {
237
237
out,
238
238
"{maybe}{suffix} {}{} {status}",
239
239
display_path.display(),
240
-
disk_kind.is_dir().then_some("/").unwrap_or_default(),
240
+
if disk_kind.is_dir() { "/" } else { Default::default() },
241
241
status = match entry.status {
242
242
Status::Ignored(kind) => {
243
243
Cow::Owned(format!(
Original file line number Diff line number Diff line change
@@ -94,11 +94,15 @@ fn write_meta(meta: &gix::config::file::Metadata, out: &mut impl std::io::Write)
94
94
.as_deref()
95
95
.map_or_else(|| "memory".into(), |p| p.display().to_string()),
96
96
meta.source,
97
-
(meta.level != 0)
98
-
.then(|| format!(", include level {}", meta.level))
99
-
.unwrap_or_default(),
100
-
(meta.trust != gix::sec::Trust::Full)
101
-
.then_some(", untrusted")
102
-
.unwrap_or_default()
97
+
if meta.level != 0 {
98
+
format!(", include level {}", meta.level)
99
+
} else {
100
+
Default::default()
101
+
},
102
+
if meta.trust != gix::sec::Trust::Full {
103
+
", untrusted"
104
+
} else {
105
+
Default::default()
106
+
}
103
107
)
104
108
}
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ fn resources_of_worktree_and_odb_and_check_link() -> crate::Result {
70
70
2,
71
71
3
72
72
)),
73
-
format!("{}test a <tmp-path> 0000000000000000000000000000000000000000 100644 <tmp-path> 4c469b6c8c4486fdc9ded9d597d8f6816a455707 100755", (!cfg!(windows)).then_some("GIT_DIFF_PATH_COUNTER=3 GIT_DIFF_PATH_TOTAL=3 GIT_DIR=. ").unwrap_or_default()),
73
+
format!("{}test a <tmp-path> 0000000000000000000000000000000000000000 100644 <tmp-path> 4c469b6c8c4486fdc9ded9d597d8f6816a455707 100755", if !cfg!(windows) { "GIT_DIFF_PATH_COUNTER=3 GIT_DIFF_PATH_TOTAL=3 GIT_DIR=. " } else { Default::default() }),
74
74
"in this case, there is no rename-to field as last argument, it's based on the resource paths being different"
75
75
);
76
76
@@ -117,7 +117,7 @@ fn resources_of_worktree_and_odb_and_check_link() -> crate::Result {
117
117
0,
118
118
1
119
119
)),
120
-
format!("{}test a <tmp-path> 0000000000000000000000000000000000000000 100644 <tmp-path> 4c469b6c8c4486fdc9ded9d597d8f6816a455707 120000", (!cfg!(windows)).then_some(r#"GIT_DIFF_PATH_COUNTER=1 GIT_DIFF_PATH_TOTAL=1 GIT_DIR=. "#).unwrap_or_default()),
120
+
format!("{}test a <tmp-path> 0000000000000000000000000000000000000000 100644 <tmp-path> 4c469b6c8c4486fdc9ded9d597d8f6816a455707 120000", if !cfg!(windows) { r#"GIT_DIFF_PATH_COUNTER=1 GIT_DIFF_PATH_TOTAL=1 GIT_DIR=. "# } else { Default::default() }),
121
121
"Also obvious that symlinks are definitely special, but it's what git does as well"
122
122
);
123
123
@@ -340,9 +340,11 @@ fn source_and_destination_do_not_exist() -> crate::Result {
340
340
),
341
341
format!(
342
342
r#"{}"test" "missing" "/dev/null" "." "." "/dev/null" "." "." "a""#,
343
-
(!cfg!(windows))
344
-
.then_some(r#"GIT_DIFF_PATH_COUNTER="1" GIT_DIFF_PATH_TOTAL="1" GIT_DIR="." "#)
345
-
.unwrap_or_default()
343
+
if !cfg!(windows) {
344
+
r#"GIT_DIFF_PATH_COUNTER="1" GIT_DIFF_PATH_TOTAL="1" GIT_DIR="." "#
345
+
} else {
346
+
Default::default()
347
+
}
346
348
)
347
349
);
348
350
Ok(())
Original file line number Diff line number Diff line change
@@ -251,9 +251,11 @@ impl super::Store {
251
251
.collect();
252
252
253
253
let mut new_slot_map_indices = Vec::new(); // these indices into the slot map still exist there/didn't change
254
-
let mut index_paths_to_add = was_uninitialized
255
-
.then(|| VecDeque::with_capacity(indices_by_modification_time.len()))
256
-
.unwrap_or_default();
254
+
let mut index_paths_to_add = if was_uninitialized {
255
+
VecDeque::with_capacity(indices_by_modification_time.len())
256
+
} else {
257
+
Default::default()
258
+
};
257
259
258
260
// Figure out this number based on what we see while handling the existing indices
259
261
let mut num_loaded_indices = 0;
@@ -389,9 +391,11 @@ impl super::Store {
389
391
generation,
390
392
// if there was a prior generation, some indices might already be loaded. But we deal with it by trying to load the next index then,
391
393
// until we find one.
392
-
next_index_to_load: index_unchanged
393
-
.then(|| Arc::clone(&index.next_index_to_load))
394
-
.unwrap_or_default(),
394
+
next_index_to_load: if index_unchanged {
395
+
Arc::clone(&index.next_index_to_load)
396
+
} else {
397
+
Default::default()
398
+
},
395
399
loaded_indices: if index_unchanged {
396
400
Arc::clone(&index.loaded_indices)
397
401
} else {
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ mod tests {
141
141
];
142
142
143
143
#[test]
144
-
#[cfg_attr(not(windows), ignore)]
144
+
#[cfg_attr(not(windows), ignore = "only meaningful on Windows")]
145
145
fn find_git_associated_windows_executable() {
146
146
for stem in SHOULD_FIND {
147
147
let path = super::find_git_associated_windows_executable(stem);
@@ -150,7 +150,7 @@ mod tests {
150
150
}
151
151
152
152
#[test]
153
-
#[cfg_attr(not(windows), ignore)]
153
+
#[cfg_attr(not(windows), ignore = "only meaningful on Windows")]
154
154
fn find_git_associated_windows_executable_no_extra() {
155
155
for stem in SHOULD_NOT_FIND {
156
156
let path = super::find_git_associated_windows_executable(stem);
@@ -159,7 +159,7 @@ mod tests {
159
159
}
160
160
161
161
#[test]
162
-
#[cfg_attr(not(windows), ignore)]
162
+
#[cfg_attr(not(windows), ignore = "only meaningful on Windows")]
163
163
fn find_git_associated_windows_executable_with_fallback() {
164
164
for stem in SHOULD_FIND {
165
165
let path = super::find_git_associated_windows_executable_with_fallback(stem);
@@ -168,7 +168,7 @@ mod tests {
168
168
}
169
169
170
170
#[test]
171
-
#[cfg_attr(not(windows), ignore)]
171
+
#[cfg_attr(not(windows), ignore = "only meaningful on Windows")]
172
172
fn find_git_associated_windows_executable_with_fallback_falls_back() {
173
173
for stem in SHOULD_NOT_FIND {
174
174
let path = super::find_git_associated_windows_executable_with_fallback(stem)
Original file line number Diff line number Diff line change
@@ -54,7 +54,11 @@ impl Pattern {
54
54
_ => 0,
55
55
})
56
56
.sum::<isize>();
57
-
(count > 0).then_some(count as usize).unwrap_or_default()
57
+
if count > 0 {
58
+
count as usize
59
+
} else {
60
+
Default::default()
61
+
}
58
62
}
59
63
60
64
let mut path = gix_path::from_bstr(self.path.as_bstr());
Original file line number Diff line number Diff line change
@@ -220,7 +220,11 @@ mod v2 {
220
220
for keepalive in [false, true] {
221
221
let fixture = format!(
222
222
"v2/clone-only{}.response",
223
-
keepalive.then_some("-with-keepalive").unwrap_or_default()
223
+
if keepalive {
224
+
"-with-keepalive"
225
+
} else {
226
+
Default::default()
227
+
}
224
228
);
225
229
let mut provider = mock_reader(&fixture);
226
230
let mut reader = provider.as_read_without_sidebands();
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4