Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 3ef8c72

Browse files
committed
fix clippy::expect_fun_call: use unwrap_or_else to prevent panic message from always being evaluated
1 parent 09f4c9f commit 3ef8c72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustdoc/docfs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ impl DocFS {
6969
let sender = self.errors.clone().expect("can't write after closing");
7070
rayon::spawn(move || {
7171
fs::write(&path, contents).unwrap_or_else(|e| {
72-
sender
73-
.send(format!("\"{}\": {}", path.display(), e))
74-
.expect(&format!("failed to send error on \"{}\"", path.display()));
72+
sender.send(format!("\"{}\": {}", path.display(), e)).unwrap_or_else(|_| {
73+
panic!("failed to send error on \"{}\"", path.display())
74+
})
7575
});
7676
});
7777
Ok(())

0 commit comments

Comments
 (0)