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

Commit 934cf28

Browse files
committed
Remove a wildcard parttern from slice patterns
1 parent 996dbbf commit 934cf28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/patterns.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ impl Rewrite for Pat {
144144
let prefix = prefix.iter().map(|p| p.rewrite(context, shape));
145145
let slice_pat = slice_pat
146146
.as_ref()
147-
.map(|p| Some(format!("{}..", p.rewrite(context, shape)?)));
147+
.and_then(|p| p.rewrite(context, shape))
148+
.map(|rw| Some(format!("{}..", if rw == "_" { "" } else { &rw })));
148149
let suffix = suffix.iter().map(|p| p.rewrite(context, shape));
149150

150151
// Munge them together.

0 commit comments

Comments
 (0)