aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2020-10-12 14:20:25 -0700
committerRichard Walters <rwalters@digitalstirling.com>2020-10-12 14:20:25 -0700
commit6a72e51973ec448f3b3d5c9c3f52daeb70829530 (patch)
tree7d4a00bcc6dbabd715258bd47abf8c1cdf1ef4d8 /src/lib.rs
parentf9a5be09cded001ae6f4b073d9f4ee4602ffee50 (diff)
Refactoring: collect path functionally
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1865b1a..f5257b4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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(