We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3bc793 commit edb59a7Copy full SHA for edb59a7
src/lib.rs
@@ -189,16 +189,10 @@ impl<T> PathTree<T> {
189
(false, Vec::new())
190
} else {
191
let pieces = Parser::new(path).collect::<Vec<_>>();
192
- for piece in &pieces {
193
- match piece {
194
- Piece::String(s) => {
195
- node = node.insert_bytes(&s[..]);
196
- }
197
- Piece::Parameter(_, k) => {
198
- node = node.insert_parameter(*k);
199
200
201
+ node = pieces.iter().fold(node, |node, piece| match piece {
+ Piece::String(s) => node.insert_bytes(&s[..]),
+ Piece::Parameter(_, k) => node.insert_parameter(*k),
+ });
202
(true, pieces)
203
};
204
0 commit comments