diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2020-10-12 14:20:25 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2020-10-12 14:20:25 -0700 |
commit | 6a72e51973ec448f3b3d5c9c3f52daeb70829530 (patch) | |
tree | 7d4a00bcc6dbabd715258bd47abf8c1cdf1ef4d8 | |
parent | f9a5be09cded001ae6f4b073d9f4ee4602ffee50 (diff) |
Refactoring: collect path functionally
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -946,20 +946,11 @@ impl Uri { "" => { }, - mut path_string => { - // TODO: Try out this improvement: - // [15:49] silen_z: path_string.split('/').collect() - loop { - if let Some(path_delimiter) = path_string.find('/') { - path_encoded.push( - path_string[0..path_delimiter].to_string() - ); - path_string = &path_string[path_delimiter+1..]; - } else { - path_encoded.push(path_string.to_string()); - break; - } - } + path_string => { + path_encoded = path_string + .split('/') + .map(String::from) + .collect() } } path_encoded.into_iter().map( |