Skip to content

Commit 8030fe1

Browse files
committed
Use if let when pushing target
1 parent 0644198 commit 8030fe1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/docbuilder/chroot_builder.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,16 @@ impl DocBuilder {
203203
target: Option<&str>,
204204
is_default_target: bool)
205205
-> Result<()> {
206-
let crate_doc_path = PathBuf::from(&self.options.chroot_path)
206+
let mut crate_doc_path = PathBuf::from(&self.options.chroot_path)
207207
.join("home")
208208
.join(&self.options.chroot_user)
209-
.join("cratesfyi")
210-
.join(target.unwrap_or(""));
209+
.join("cratesfyi");
210+
211+
// docs are available in cratesfyi/$TARGET when target is being used
212+
if let Some(target) = target {
213+
crate_doc_path.push(target);
214+
}
215+
211216
let mut destination = PathBuf::from(&self.options.destination)
212217
.join(format!("{}/{}",
213218
package.manifest().name(),
@@ -219,7 +224,9 @@ impl DocBuilder {
219224
// default target: x86_64-pc-windows-msvc. But since it will be built under
220225
// cratesfyi/x86_64-pc-windows-msvc we still need target in this function.
221226
if !is_default_target {
222-
destination.push(target.unwrap_or(""));
227+
if let Some(target) = target {
228+
destination.push(target);
229+
}
223230
}
224231

225232
copy_doc_dir(crate_doc_path,

0 commit comments

Comments
 (0)