Skip to content

Commit 299f2a7

Browse files
committed
replace .ok_or_else(|| anyhow::anyhow! with .context(
1 parent 83be5a7 commit 299f2a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/github.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,13 +1712,13 @@ impl Repository {
17121712
}
17131713
let target = data
17141714
.data
1715-
.ok_or_else(|| anyhow::anyhow!("No data returned."))?
1715+
.context("No data returned.")?
17161716
.repository
1717-
.ok_or_else(|| anyhow::anyhow!("No repository."))?
1717+
.context("No repository.")?
17181718
.ref_
1719-
.ok_or_else(|| anyhow::anyhow!("No ref."))?
1719+
.context("No ref.")?
17201720
.target
1721-
.ok_or_else(|| anyhow::anyhow!("No target."))?;
1721+
.context("No target.")?;
17221722
let commit = match target {
17231723
GitObject::Commit(commit) => commit,
17241724
_ => anyhow::bail!("unexpected target type {target:?}"),

0 commit comments

Comments
 (0)