Skip to content

Commit 5cdf8b6

Browse files
traviscrossehuss
authored andcommitted
Replace a match with let-else
We can save a line by replacing this `match` with a `let-else`, so let's do that.
1 parent 383dbb9 commit 5cdf8b6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mdbook-spec/src/grammar/render_markdown.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ impl Grammar {
2020
) -> anyhow::Result<()> {
2121
let mut iter = names.into_iter().peekable();
2222
while let Some(name) = iter.next() {
23-
let prod = match self.productions.get(*name) {
24-
Some(p) => p,
25-
None => bail!("could not find grammar production named `{name}`"),
23+
let Some(prod) = self.productions.get(*name) else {
24+
bail!("could not find grammar production named `{name}`");
2625
};
2726
prod.render_markdown(link_map, rr_link_map, output, for_summary);
2827
if iter.peek().is_some() {

0 commit comments

Comments
 (0)